Control

Inherits: CanvasItem < Node < Object

Inherited By: BaseButton, ColorRect, Container, EditorDebuggerPlugin, GraphEdit, ItemList, Label, LineEdit, MenuBar, NinePatchRect, Panel, Range, ReferenceRect, RichTextLabel, Separator, TabBar, TextEdit, TextureRect, Tree, VideoStreamPlayer

All user interface nodes inherit from Control. A control's anchors and offsets adapt its position and size relative to its parent.

Description

Base class for all UI-related nodes. Control features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and offsets relative to the anchor. The offsets update automatically when the node, any of its parents, or the screen size change.

For more information on Godot's UI system, anchors, offsets, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from Control and Container nodes.

User Interface nodes and input

Godot sends input events to the scene's root node first, by calling Node._input. Node._input forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls MainLoop._input_event.

FIXME: No longer valid after DisplayServer split and Input refactoring.

Call accept_event so no other node receives the event. Once you accept an input, it becomes handled so Node._unhandled_input will not process it.

Only one Control node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the focus, call grab_focus. Control nodes lose focus when another node grabs it, or if you hide the node in focus.

Sets mouse_filter to MOUSE_FILTER_IGNORE to tell a Control node to ignore mouse or touch events. You'll need it if you place an icon on top of a button.

Theme resources change the Control's appearance. If you change the Theme on a Control node, it affects all of its children. To override some of the theme's parameters, call one of the add_theme_*_override methods, like add_theme_font_override. You can override the theme with the inspector.

Note: Theme items are not Object properties. This means you can't access their values using Object.get and Object.set. Instead, use the get_theme_* and add_theme_*_override methods provided by this class.

Tutorials

Properties

float

anchor_bottom

0.0

float

anchor_left

0.0

float

anchor_right

0.0

float

anchor_top

0.0

bool

auto_translate

true

bool

clip_contents

false

Vector2i

custom_minimum_size

Vector2i(0, 0)

FocusMode

focus_mode

0

NodePath

focus_neighbor_bottom

NodePath("")

NodePath

focus_neighbor_left

NodePath("")

NodePath

focus_neighbor_right

NodePath("")

NodePath

focus_neighbor_top

NodePath("")

NodePath

focus_next

NodePath("")

NodePath

focus_previous

NodePath("")

Vector2

global_position

GrowDirection

grow_horizontal

1

GrowDirection

grow_vertical

1

LayoutDirection

layout_direction

0

CursorShape

mouse_default_cursor_shape

0

MouseFilter

mouse_filter

0

bool

mouse_force_pass_scroll_events

true

float

offset_bottom

0.0

float

offset_left

0.0

float

offset_right

0.0

float

offset_top

0.0

Vector2

pivot_offset

Vector2(0, 0)

Vector2

position

Vector2(0, 0)

float

rotation

0.0

Vector2

scale

Vector2(1, 1)

Vector2

size

Vector2(0, 0)

int

size_flags_horizontal

1

float

size_flags_stretch_ratio

1.0

int

size_flags_vertical

1

Theme

theme

StringName

theme_type_variation

&""

String

tooltip_text

""

Methods

bool

_can_drop_data ( Vector2 at_position, Variant data ) virtual const

void

_drop_data ( Vector2 at_position, Variant data ) virtual

Variant

_get_drag_data ( Vector2 at_position ) virtual const

Vector2

_get_minimum_size ( ) virtual const

void

_gui_input ( InputEvent event ) virtual

bool

_has_point ( Vector2 position ) virtual const

Object

_make_custom_tooltip ( String for_text ) virtual const

Vector2i[]

_structured_text_parser ( Array args, String text ) virtual const

void

accept_event ( )

void

add_theme_color_override ( StringName name, Color color )

void

add_theme_constant_override ( StringName name, int constant )

void

add_theme_font_override ( StringName name, Font font )

void

add_theme_font_size_override ( StringName name, int font_size )

void

add_theme_icon_override ( StringName name, Texture2D texture )

void

add_theme_stylebox_override ( StringName name, StyleBox stylebox )

void

begin_bulk_theme_override ( )

void

end_bulk_theme_override ( )

Control

find_next_valid_focus ( ) const

Control

find_prev_valid_focus ( ) const

void

force_drag ( Variant data, Control preview )

float

get_anchor ( Side side ) const

Vector2

get_begin ( ) const

Vector2

get_combined_minimum_size ( ) const

CursorShape

get_cursor_shape ( Vector2 position=Vector2(0, 0) ) const

Vector2

get_end ( ) const

NodePath

get_focus_neighbor ( Side side ) const

Rect2

get_global_rect ( ) const

Vector2

get_minimum_size ( ) const

float

get_offset ( Side offset ) const

Vector2

get_parent_area_size ( ) const

Control

get_parent_control ( ) const

Rect2

get_rect ( ) const

Vector2

get_screen_position ( ) const

Color

get_theme_color ( StringName name, StringName theme_type="" ) const

int

get_theme_constant ( StringName name, StringName theme_type="" ) const

float

get_theme_default_base_scale ( ) const

Font

get_theme_default_font ( ) const

int

get_theme_default_font_size ( ) const

Font

get_theme_font ( StringName name, StringName theme_type="" ) const

int

get_theme_font_size ( StringName name, StringName theme_type="" ) const

Texture2D

get_theme_icon ( StringName name, StringName theme_type="" ) const

StyleBox

get_theme_stylebox ( StringName name, StringName theme_type="" ) const

String

get_tooltip ( Vector2 at_position=Vector2(0, 0) ) const

void

grab_click_focus ( )

void

grab_focus ( )

bool

has_focus ( ) const

bool

has_theme_color ( StringName name, StringName theme_type="" ) const

bool

has_theme_color_override ( StringName name ) const

bool

has_theme_constant ( StringName name, StringName theme_type="" ) const

bool

has_theme_constant_override ( StringName name ) const

bool

has_theme_font ( StringName name, StringName theme_type="" ) const

bool

has_theme_font_override ( StringName name ) const

bool

has_theme_font_size ( StringName name, StringName theme_type="" ) const

bool

has_theme_font_size_override ( StringName name ) const

bool

has_theme_icon ( StringName name, StringName theme_type="" ) const

bool

has_theme_icon_override ( StringName name ) const

bool

has_theme_stylebox ( StringName name, StringName theme_type="" ) const

bool

has_theme_stylebox_override ( StringName name ) const

bool

is_drag_successful ( ) const

bool

is_layout_rtl ( ) const

void

release_focus ( )

void

remove_theme_color_override ( StringName name )

void

remove_theme_constant_override ( StringName name )

void

remove_theme_font_override ( StringName name )

void

remove_theme_font_size_override ( StringName name )

void

remove_theme_icon_override ( StringName name )

void

remove_theme_stylebox_override ( StringName name )

void

reset_size ( )

void

set_anchor ( Side side, float anchor, bool keep_offset=false, bool push_opposite_anchor=true )

void

set_anchor_and_offset ( Side side, float anchor, float offset, bool push_opposite_anchor=false )

void

set_anchors_and_offsets_preset ( LayoutPreset preset, LayoutPresetMode resize_mode=0, int margin=0 )

void

set_anchors_preset ( LayoutPreset preset, bool keep_offsets=false )

void

set_begin ( Vector2 position )

void

set_drag_forwarding ( Object target )

void

set_drag_preview ( Control control )

void

set_end ( Vector2 position )

void

set_focus_neighbor ( Side side, NodePath neighbor )

void

set_global_position ( Vector2 position, bool keep_offsets=false )

void

set_offset ( Side side, float offset )

void

set_offsets_preset ( LayoutPreset preset, LayoutPresetMode resize_mode=0, int margin=0 )

void

set_position ( Vector2 position, bool keep_offsets=false )

void

set_size ( Vector2 size, bool keep_offsets=false )

void

update_minimum_size ( )

void

warp_mouse ( Vector2 position )

Signals

  • focus_entered ( )

Emitted when the node gains keyboard focus.


  • focus_exited ( )

Emitted when the node loses keyboard focus.


Emitted when the node receives an InputEvent.


  • minimum_size_changed ( )

Emitted when the node's minimum size changes.


  • mouse_entered ( )

Emitted when the mouse enters the control's Rect area, provided its mouse_filter lets the event reach it.

Note: mouse_entered will not be emitted if the mouse enters a child Control node before entering the parent's Rect area, at least until the mouse is moved to reach the parent's Rect area.


  • mouse_exited ( )

Emitted when the mouse leaves the control's Rect area, provided its mouse_filter lets the event reach it.

Note: mouse_exited will be emitted if the mouse enters a child Control node, even if the mouse cursor is still inside the parent's Rect area.

If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:

func _on_mouse_exited():
    if not Rect2(Vector2(), size).has_point(get_local_mouse_position()):
        # Not hovering over area.

  • resized ( )

Emitted when the control changes size.


  • size_flags_changed ( )

Emitted when one of the size flags changes. See size_flags_horizontal and size_flags_vertical.


  • theme_changed ( )

Emitted when the NOTIFICATION_THEME_CHANGED notification is sent.

Enumerations

enum FocusMode:

  • FOCUS_NONE = 0 --- The node cannot grab focus. Use with focus_mode.

  • FOCUS_CLICK = 1 --- The node can only grab focus on mouse clicks. Use with focus_mode.

  • FOCUS_ALL = 2 --- The node can grab focus on mouse click or using the arrows and the Tab keys on the keyboard. Use with focus_mode.


enum CursorShape:

  • CURSOR_ARROW = 0 --- Show the system's arrow mouse cursor when the user hovers the node. Use with mouse_default_cursor_shape.

  • CURSOR_IBEAM = 1 --- Show the system's I-beam mouse cursor when the user hovers the node. The I-beam pointer has a shape similar to "I". It tells the user they can highlight or insert text.

  • CURSOR_POINTING_HAND = 2 --- Show the system's pointing hand mouse cursor when the user hovers the node.

  • CURSOR_CROSS = 3 --- Show the system's cross mouse cursor when the user hovers the node.

  • CURSOR_WAIT = 4 --- Show the system's wait mouse cursor when the user hovers the node. Often an hourglass.

  • CURSOR_BUSY = 5 --- Show the system's busy mouse cursor when the user hovers the node. Often an arrow with a small hourglass.

  • CURSOR_DRAG = 6 --- Show the system's drag mouse cursor, often a closed fist or a cross symbol, when the user hovers the node. It tells the user they're currently dragging an item, like a node in the Scene dock.

  • CURSOR_CAN_DROP = 7 --- Show the system's drop mouse cursor when the user hovers the node. It can be an open hand. It tells the user they can drop an item they're currently grabbing, like a node in the Scene dock.

  • CURSOR_FORBIDDEN = 8 --- Show the system's forbidden mouse cursor when the user hovers the node. Often a crossed circle.

  • CURSOR_VSIZE = 9 --- Show the system's vertical resize mouse cursor when the user hovers the node. A double-headed vertical arrow. It tells the user they can resize the window or the panel vertically.

  • CURSOR_HSIZE = 10 --- Show the system's horizontal resize mouse cursor when the user hovers the node. A double-headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.

  • CURSOR_BDIAGSIZE = 11 --- Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double-headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.

  • CURSOR_FDIAGSIZE = 12 --- Show the system's window resize mouse cursor when the user hovers the node. The cursor is a double-headed arrow that goes from the top left to the bottom right, the opposite of CURSOR_BDIAGSIZE. It tells the user they can resize the window or the panel both horizontally and vertically.

  • CURSOR_MOVE = 13 --- Show the system's move mouse cursor when the user hovers the node. It shows 2 double-headed arrows at a 90 degree angle. It tells the user they can move a UI element freely.

  • CURSOR_VSPLIT = 14 --- Show the system's vertical split mouse cursor when the user hovers the node. On Windows, it's the same as CURSOR_VSIZE.

  • CURSOR_HSPLIT = 15 --- Show the system's horizontal split mouse cursor when the user hovers the node. On Windows, it's the same as CURSOR_HSIZE.

  • CURSOR_HELP = 16 --- Show the system's help mouse cursor when the user hovers the node, a question mark.


enum LayoutPreset:

  • PRESET_TOP_LEFT = 0 --- Snap all 4 anchors to the top-left of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_TOP_RIGHT = 1 --- Snap all 4 anchors to the top-right of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_BOTTOM_LEFT = 2 --- Snap all 4 anchors to the bottom-left of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_BOTTOM_RIGHT = 3 --- Snap all 4 anchors to the bottom-right of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_CENTER_LEFT = 4 --- Snap all 4 anchors to the center of the left edge of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_CENTER_TOP = 5 --- Snap all 4 anchors to the center of the top edge of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_CENTER_RIGHT = 6 --- Snap all 4 anchors to the center of the right edge of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_CENTER_BOTTOM = 7 --- Snap all 4 anchors to the center of the bottom edge of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_CENTER = 8 --- Snap all 4 anchors to the center of the parent control's bounds. Use with set_anchors_preset.

  • PRESET_LEFT_WIDE = 9 --- Snap all 4 anchors to the left edge of the parent control. The left offset becomes relative to the left edge and the top offset relative to the top left corner of the node's parent. Use with set_anchors_preset.

  • PRESET_TOP_WIDE = 10 --- Snap all 4 anchors to the top edge of the parent control. The left offset becomes relative to the top left corner, the top offset relative to the top edge, and the right offset relative to the top right corner of the node's parent. Use with set_anchors_preset.

  • PRESET_RIGHT_WIDE = 11 --- Snap all 4 anchors to the right edge of the parent control. The right offset becomes relative to the right edge and the top offset relative to the top right corner of the node's parent. Use with set_anchors_preset.

  • PRESET_BOTTOM_WIDE = 12 --- Snap all 4 anchors to the bottom edge of the parent control. The left offset becomes relative to the bottom left corner, the bottom offset relative to the bottom edge, and the right offset relative to the bottom right corner of the node's parent. Use with set_anchors_preset.

  • PRESET_VCENTER_WIDE = 13 --- Snap all 4 anchors to a vertical line that cuts the parent control in half. Use with set_anchors_preset.

  • PRESET_HCENTER_WIDE = 14 --- Snap all 4 anchors to a horizontal line that cuts the parent control in half. Use with set_anchors_preset.

  • PRESET_FULL_RECT = 15 --- Snap all 4 anchors to the respective corners of the parent control. Set all 4 offsets to 0 after you applied this preset and the Control will fit its parent control. Use with set_anchors_preset.


enum LayoutPresetMode:

  • PRESET_MODE_MINSIZE = 0 --- The control will be resized to its minimum size.

  • PRESET_MODE_KEEP_WIDTH = 1 --- The control's width will not change.

  • PRESET_MODE_KEEP_HEIGHT = 2 --- The control's height will not change.

  • PRESET_MODE_KEEP_SIZE = 3 --- The control's size will not change.


enum SizeFlags:

Note: Setting this flag is equal to not having any size flags.


enum MouseFilter:

  • MOUSE_FILTER_STOP = 0 --- The control will receive mouse button input events through _gui_input if clicked on. And the control will receive the mouse_entered and mouse_exited signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls.

  • MOUSE_FILTER_PASS = 1 --- The control will receive mouse button input events through _gui_input if clicked on. And the control will receive the mouse_entered and mouse_exited signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. If no control handled it, the event will be passed to _unhandled_input for further processing.

  • MOUSE_FILTER_IGNORE = 2 --- The control will not receive mouse button input events through _gui_input. The control will also not receive the mouse_entered nor mouse_exited signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically.


enum GrowDirection:

  • GROW_DIRECTION_BEGIN = 0 --- The control will grow to the left or top to make up if its minimum size is changed to be greater than its current size on the respective axis.

  • GROW_DIRECTION_END = 1 --- The control will grow to the right or bottom to make up if its minimum size is changed to be greater than its current size on the respective axis.

  • GROW_DIRECTION_BOTH = 2 --- The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.


enum Anchor:

  • ANCHOR_BEGIN = 0 --- Snaps one of the 4 anchor's sides to the origin of the node's Rect, in the top left. Use it with one of the anchor_* member variables, like anchor_left. To change all 4 anchors at once, use set_anchors_preset.

  • ANCHOR_END = 1 --- Snaps one of the 4 anchor's sides to the end of the node's Rect, in the bottom right. Use it with one of the anchor_* member variables, like anchor_left. To change all 4 anchors at once, use set_anchors_preset.


enum LayoutDirection:

  • LAYOUT_DIRECTION_INHERITED = 0 --- Automatic layout direction, determined from the parent control layout direction.

  • LAYOUT_DIRECTION_LOCALE = 1 --- Automatic layout direction, determined from the current locale.

  • LAYOUT_DIRECTION_LTR = 2 --- Left-to-right layout direction.

  • LAYOUT_DIRECTION_RTL = 3 --- Right-to-left layout direction.


enum TextDirection:

  • TEXT_DIRECTION_INHERITED = 3 --- Text writing direction is the same as layout direction.

  • TEXT_DIRECTION_AUTO = 0 --- Automatic text writing direction, determined from the current locale and text content.

  • TEXT_DIRECTION_LTR = 1 --- Left-to-right text writing direction.

  • TEXT_DIRECTION_RTL = 2 --- Right-to-left text writing direction.

Constants

  • NOTIFICATION_RESIZED = 40 --- Sent when the node changes size. Use size to get the new size.

  • NOTIFICATION_MOUSE_ENTER = 41 --- Sent when the mouse pointer enters the node.

  • NOTIFICATION_MOUSE_EXIT = 42 --- Sent when the mouse pointer exits the node.

  • NOTIFICATION_FOCUS_ENTER = 43 --- Sent when the node grabs focus.

  • NOTIFICATION_FOCUS_EXIT = 44 --- Sent when the node loses focus.

  • NOTIFICATION_THEME_CHANGED = 45 --- Sent when the node needs to refresh its theme items. This happens in one of the following cases:

  • The theme property is changed on this node or any of its ancestors.

  • The theme_type_variation property is changed on this node.

  • One of the node's theme property overrides is changed.

  • The node enters the scene tree.

Note: As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.

  • NOTIFICATION_SCROLL_BEGIN = 47 --- Sent when this node is inside a ScrollContainer which has begun being scrolled.

  • NOTIFICATION_SCROLL_END = 48 --- Sent when this node is inside a ScrollContainer which has stopped being scrolled.

  • NOTIFICATION_LAYOUT_DIRECTION_CHANGED = 49 --- Sent when control layout direction is changed.

Property Descriptions

Default

0.0

Getter

get_anchor()

Anchors the bottom edge of the node to the origin, the center, or the end of its parent control. It changes how the bottom offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.


Default

0.0

Getter

get_anchor()

Anchors the left edge of the node to the origin, the center or the end of its parent control. It changes how the left offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.


Default

0.0

Getter

get_anchor()

Anchors the right edge of the node to the origin, the center or the end of its parent control. It changes how the right offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.


Default

0.0

Getter

get_anchor()

Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top offset updates when the node moves or changes size. You can use one of the Anchor constants for convenience.


  • bool auto_translate

Default

true

Setter

set_auto_translate(value)

Getter

is_auto_translating()

Toggles if any text should automatically change to its translated version depending on the current locale. Note that this will not affect any internal nodes (e.g. the popup of a MenuButton).

Also decides if the node's strings should be parsed for POT generation.


  • bool clip_contents

Default

false

Setter

set_clip_contents(value)

Getter

is_clipping_contents()

Enables whether rendering of CanvasItem based children should be clipped to this control's rectangle. If true, parts of a child which would be visibly outside of this control's rectangle will not be rendered and won't receive input.


Default

Vector2i(0, 0)

Setter

set_custom_minimum_size(value)

Getter

get_custom_minimum_size()

The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes.


Default

0

Setter

set_focus_mode(value)

Getter

get_focus_mode()

The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard signals.


Default

NodePath("")

Setter

set_focus_neighbor(value)

Getter

get_focus_neighbor()

Tells Godot which node it should give keyboard focus to if the user presses the down arrow on the keyboard or down on a gamepad by default. You can change the key by editing the ui_down input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the bottom of this one.


Default

NodePath("")

Setter

set_focus_neighbor(value)

Getter

get_focus_neighbor()

Tells Godot which node it should give keyboard focus to if the user presses the left arrow on the keyboard or left on a gamepad by default. You can change the key by editing the ui_left input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the left of this one.


Default

NodePath("")

Setter

set_focus_neighbor(value)

Getter

get_focus_neighbor()

Tells Godot which node it should give keyboard focus to if the user presses the right arrow on the keyboard or right on a gamepad by default. You can change the key by editing the ui_right input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the bottom of this one.


Default

NodePath("")

Setter

set_focus_neighbor(value)

Getter

get_focus_neighbor()

Tells Godot which node it should give keyboard focus to if the user presses the top arrow on the keyboard or top on a gamepad by default. You can change the key by editing the ui_top input action. The node must be a Control. If this property is not set, Godot will give focus to the closest Control to the bottom of this one.


Default

NodePath("")

Setter

set_focus_next(value)

Getter

get_focus_next()

Tells Godot which node it should give keyboard focus to if the user presses Tab on a keyboard by default. You can change the key by editing the ui_focus_next input action.

If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.


Default

NodePath("")

Setter

set_focus_previous(value)

Getter

get_focus_previous()

Tells Godot which node it should give keyboard focus to if the user presses Shift + Tab on a keyboard by default. You can change the key by editing the ui_focus_prev input action.

If this property is not set, Godot will select a "best guess" based on surrounding nodes in the scene tree.


Getter

get_global_position()

The node's global position, relative to the world (usually to the top-left corner of the window).


Default

1

Setter

set_h_grow_direction(value)

Getter

get_h_grow_direction()

Controls the direction on the horizontal axis in which the control should grow if its horizontal minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.


Default

1

Setter

set_v_grow_direction(value)

Getter

get_v_grow_direction()

Controls the direction on the vertical axis in which the control should grow if its vertical minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.


Default

0

Setter

set_layout_direction(value)

Getter

get_layout_direction()

Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).


Default

0

Setter

set_default_cursor_shape(value)

Getter

get_default_cursor_shape()

The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors.

Note: On Linux, shapes may vary depending on the cursor theme of the system.


Default

0

Setter

set_mouse_filter(value)

Getter

get_mouse_filter()

Controls whether the control will be able to receive mouse button input events through _gui_input and how these events should be handled. Also controls whether the control can receive the mouse_entered, and mouse_exited signals. See the constants to learn what each does.


  • bool mouse_force_pass_scroll_events

Default

true

Setter

set_force_pass_scroll_events(value)

Getter

is_force_pass_scroll_events()

When enabled, scroll wheel events processed by _gui_input will be passed to the parent control even if mouse_filter is set to MOUSE_FILTER_STOP. As it defaults to true, this allows nested scrollable containers to work out of the box.

You should disable it on the root of your UI if you do not want scroll events to go to the _unhandled_input processing.


Default

0.0

Setter

set_offset(value)

Getter

get_offset()

Distance between the node's bottom edge and its parent control, based on anchor_bottom.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.


Default

0.0

Setter

set_offset(value)

Getter

get_offset()

Distance between the node's left edge and its parent control, based on anchor_left.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.


Default

0.0

Setter

set_offset(value)

Getter

get_offset()

Distance between the node's right edge and its parent control, based on anchor_right.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.


Default

0.0

Setter

set_offset(value)

Getter

get_offset()

Distance between the node's top edge and its parent control, based on anchor_top.

Offsets are often controlled by one or multiple parent Container nodes, so you should not modify them manually if your node is a direct child of a Container. Offsets update automatically when you move or resize the node.


Default

Vector2(0, 0)

Setter

set_pivot_offset(value)

Getter

get_pivot_offset()

By default, the node's pivot is its top-left corner. When you change its rotation or scale, it will rotate or scale around this pivot. Set this property to size / 2 to pivot around the Control's center.


Default

Vector2(0, 0)

Getter

get_position()

The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by pivot_offset.


Default

0.0

Setter

set_rotation(value)

Getter

get_rotation()

The node's rotation around its pivot, in radians. See pivot_offset to change the pivot's position.


Default

Vector2(1, 1)

Setter

set_scale(value)

Getter

get_scale()

The node's scale, relative to its size. Change this property to scale the node around its pivot_offset. The Control's tooltip_text will also scale according to this value.

Note: This property is mainly intended to be used for animation purposes. Text inside the Control will look pixelated or blurry when the Control is scaled. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the documentation instead of scaling Controls individually.

Note: If the Control node is a child of a Container node, the scale will be reset to Vector2(1, 1) when the scene is instantiated. To set the Control's scale when it's instantiated, wait for one frame using await get_tree().process_frame then set its scale property.


Default

Vector2(0, 0)

Getter

get_size()

The size of the node's bounding rectangle, in pixels. Container nodes update this property automatically.


  • int size_flags_horizontal

Default

1

Setter

set_h_size_flags(value)

Getter

get_h_size_flags()

Tells the parent Container nodes how they should resize and place the node on the X axis. Use one of the SizeFlags constants to change the flags. See the constants to learn what each does.


  • float size_flags_stretch_ratio

</