Struct gdnative_bindings_lily::TextEdit [−][src]
pub struct TextEdit { /* fields omitted */ }
Expand description
core class TextEdit
inherits Control
(unsafe).
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
Memory management
Non reference counted objects such as the ones of this type are usually owned by the engine.
TextEdit
is a reference-only type. Persistent references can
only exist in the unsafe Ref<TextEdit>
form.
In the cases where Rust code owns an object of this type, for example if the object was just
created on the Rust side and not passed to the engine yet, ownership should be either given
to the engine or the object must be manually destroyed using Ref::free
, or Ref::queue_free
if it is a Node
.
Class hierarchy
TextEdit inherits methods from:
Safety
All types in the Godot API have “interior mutability” in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref
and TRef
smart pointers,
and the Instance
API. The typestate Access
in these types tracks whether the
access is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations
Constants
Creates a new instance of this object.
Because this type is not reference counted, the lifetime of the returned object is not automatically managed.
Immediately after creation, the object is owned by the caller, and can be
passed to the engine (in which case the engine will be responsible for
destroying the object) or destroyed manually using Ref::free
, or preferably
Ref::queue_free
if it is a Node
.
pub fn add_color_region(
&self,
begin_key: impl Into<GodotString>,
end_key: impl Into<GodotString>,
color: Color,
line_only: bool
)
pub fn add_color_region(
&self,
begin_key: impl Into<GodotString>,
end_key: impl Into<GodotString>,
color: Color,
line_only: bool
)
Adds a keyword
and its Color.
Returns if the given line is foldable, that is, it has indented lines right below it.
Centers the viewport on the line the editing cursor is at. This also resets the [member scroll_horizontal] value to 0
.
Clears all custom syntax coloring information previously added with [method add_color_region] or [method add_keyword_color].
Clears the undo history.
If true
, the caret (visual cursor) blinks.
Duration (in seconds) of a caret’s blinking cycle.
Returns the column the editing cursor is at.
Returns the line the editing cursor is at.
If true
, the caret displays as a rectangle.
If false
, the caret displays as a bar.
If true
, the caret (visual cursor) blinks.
Duration (in seconds) of a caret’s blinking cycle.
If true
, the caret displays as a rectangle.
If false
, the caret displays as a bar.
Moves the cursor at the specified column
index.
If adjust_viewport
is set to true
, the viewport will center at the cursor position after the move occurs.
Default Arguments
adjust_viewport
-true
Moves the cursor at the specified line
index.
If adjust_viewport
is set to true
, the viewport will center at the cursor position after the move occurs.
If can_be_hidden
is set to true
, the specified line
can be hidden using [method set_line_as_hidden].
Default Arguments
adjust_viewport
-true
can_be_hidden
-true
wrap_index
-0
If true
, a minimap is shown, providing an outline of your source code.
Folds all lines that are possible to be folded (see [method can_fold]).
Returns an array containing the line number of each breakpoint.
Returns the Color of the specified keyword
.
Returns the text of a specific line.
Returns the amount of total lines in the text.
The width, in pixels, of the minimap.
Returns the selection begin column.
Returns the selection begin line.
Returns the text inside the selection.
Returns the selection end column.
Returns the selection end line.
String value of the TextEdit.
Vertical scroll sensitivity.
Returns a String text with the word under the mouse cursor location.
Returns whether the specified keyword
has a color set to it or not.
Insert the specified text at the cursor position.
If true
, the breakpoint gutter is visible.
If true
, a right-click displays the context menu.
If true
, the fold gutter is visible. This enables folding groups of indented lines.
If true
, a minimap is shown, providing an outline of your source code.
If true
, the “space” character will have a visible representation.
If true
, the “tab” character will have a visible representation.
Returns whether the line at the specified index is folded or not.
If true
, all lines that have been set to hidden by [method set_line_as_hidden], will not be visible.
If true
, all occurrences of the selected text will be highlighted.
If true
, the line containing the cursor is highlighted.
Returns whether the line at the specified index is hidden or not.
If true
, custom font_color_selected
will be used for selected text.
If true
, read-only mode is enabled. Existing text cannot be modified and new text cannot be added.
If true
, a right-click moves the cursor at the mouse position before displaying the context menu.
If false
, the context menu disregards mouse location.
If true
, text can be selected.
If false
, text can not be selected by the user or by the [method select] or [method select_all] methods.
Returns true
if the selection is active.
If true
, shortcut keys for context menu items are enabled, even if the context menu is disabled.
If true
, line numbers are displayed to the left of the text.
If true
, sets the step
of the scrollbars to 0.25
which results in smoother scrolling.
If true
, any custom color properties that have been set for this TextEdit will be visible.
If true
, the native virtual keyboard is shown when focused on platforms that support it.
If true
, enables text wrapping when it goes beyond the edge of what is visible.
Triggers a right-click menu action by the specified index. See [enum MenuItems] for a list of available indexes.
Removes all the breakpoints. This will not fire the [signal breakpoint_toggled] signal.
pub fn search(
&self,
key: impl Into<GodotString>,
flags: i64,
from_line: i64,
from_column: i64
) -> Int32Array
pub fn search(
&self,
key: impl Into<GodotString>,
flags: i64,
from_line: i64,
from_column: i64
) -> Int32Array
Sample code is GDScript unless otherwise noted.
Perform a search inside the text. Search flags can be specified in the [enum SearchFlags] enum.
Returns an empty PoolIntArray
if no result was found. Otherwise, the result line and column can be accessed at indices specified in the [enum SearchResult] enum, e.g:
var result = search(key, flags, line, column)
if result.size() > 0:
# Result found.
var res_line = result[TextEdit.SEARCH_RESULT_LINE]
var res_column = result[TextEdit.SEARCH_RESULT_COLUMN]
Perform selection, from line/column to line/column.
If [member selecting_enabled] is false
, no selection will occur.
Select all the text.
If [member selecting_enabled] is false
, no selection will occur.
If true
, the breakpoint gutter is visible.
If true
, a right-click displays the context menu.
If true
, the fold gutter is visible. This enables folding groups of indented lines.
If true
, the “space” character will have a visible representation.
If true
, the “tab” character will have a visible representation.
The current horizontal scroll value.
If true
, all lines that have been set to hidden by [method set_line_as_hidden], will not be visible.
If true
, all occurrences of the selected text will be highlighted.
If true
, the line containing the cursor is highlighted.
Sets the text for a specific line.
If true
, hides the line of the specified index.
The width, in pixels, of the minimap.
If true
, custom font_color_selected
will be used for selected text.
If true
, read-only mode is enabled. Existing text cannot be modified and new text cannot be added.
If true
, a right-click moves the cursor at the mouse position before displaying the context menu.
If false
, the context menu disregards mouse location.
If true
, text can be selected.
If false
, text can not be selected by the user or by the [method select] or [method select_all] methods.
If true
, shortcut keys for context menu items are enabled, even if the context menu is disabled.
If true
, line numbers are displayed to the left of the text.
If true
, sets the step
of the scrollbars to 0.25
which results in smoother scrolling.
If true
, any custom color properties that have been set for this TextEdit will be visible.
String value of the TextEdit.
The current vertical scroll value.
Vertical scroll sensitivity.
If true
, the native virtual keyboard is shown when focused on platforms that support it.
If true
, enables text wrapping when it goes beyond the edge of what is visible.
Toggle the folding of the code block at the given line.
Unfolds the given line, if folded.
Unhide all lines that were previously set to hidden by [method set_line_as_hidden].
Methods from Deref<Target = Control>
Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input].
Sample code is GDScript unless otherwise noted.
Overrides the Color with given name
in the [member theme] resource the control uses.
Note: Unlike other theme overrides, there is no way to undo a color override without manually assigning the previous color.
Example of overriding a label’s color and resetting it later:
# Override the child node "MyLabel"'s font color to orange.
$MyLabel.add_color_override("font_color", Color(1, 0.5, 0))
# Reset the color by creating a new node to get the default value:
var default_label_color = Label.new().get_color("font_color")
$MyLabel.add_color_override("font_color", default_label_color)
Overrides an integer constant with given name
in the [member theme] resource the control uses. If the constant
is 0
, the override is cleared and the constant from assigned Theme is used.
Overrides the font with given name
in the [member theme] resource the control uses. If font
is null
or invalid, the override is cleared and the font from assigned Theme is used.
Overrides the icon with given name
in the [member theme] resource the control uses. If icon
is null
or invalid, the override is cleared and the icon from assigned Theme is used.
pub fn add_stylebox_override(
&self,
name: impl Into<GodotString>,
stylebox: impl AsArg<StyleBox>
)
pub fn add_stylebox_override(
&self,
name: impl Into<GodotString>,
stylebox: impl AsArg<StyleBox>
)
Sample code is GDScript unless otherwise noted.
Overrides the StyleBox with given name
in the [member theme] resource the control uses. If stylebox
is empty or invalid, the override is cleared and the StyleBox from assigned Theme is used.
Example of modifying a property in a StyleBox by duplicating it:
# The snippet below assumes the child node MyButton has a StyleBoxFlat assigned.
# Resources are shared across instances, so we need to duplicate it
# to avoid modifying the appearance of all other buttons.
var new_stylebox_normal = $MyButton.get_stylebox("normal").duplicate()
new_stylebox_normal.border_width_top = 3
new_stylebox_normal.border_color = Color(0, 1, 0.5)
$MyButton.add_stylebox_override("normal", new_stylebox_normal)
# Remove the stylebox override:
$MyButton.add_stylebox_override("normal", null)
Forces drag and bypasses [method get_drag_data] and [method set_drag_preview] by passing data
and preview
. Drag will start even if the mouse is neither over nor pressed on this control.
The methods [method can_drop_data] and [method drop_data] must be implemented on controls that want to receive drop data.
Anchors the top edge of the node to the origin, the center or the end of its parent control. It changes how the top margin updates when the node moves or changes size. You can use one of the [enum Anchor] constants for convenience.
Returns [member margin_left] and [member margin_top]. See also [member rect_position].
pub fn get_color(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Color
pub fn get_color(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Color
Sample code is GDScript unless otherwise noted.
Returns a color from assigned Theme with given name
and associated with Control of given type
.
func _ready():
modulate = get_color("font_color", "Button") #get the color defined for button fonts
Default Arguments
type
-""
Returns combined minimum size from [member rect_min_size] and [method get_minimum_size].
pub fn get_constant(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> i64
pub fn get_constant(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> i64
Returns a constant from assigned Theme with given name
and associated with Control of given type
.
Default Arguments
type
-""
Returns the mouse cursor shape the control displays on mouse hover. See [enum CursorShape].
Default Arguments
position
-Vector2( 0, 0 )
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.
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.
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.
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.
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.
Returns the control that has the keyboard focus or null
if none.
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.
pub fn get_font(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Option<Ref<Font, Shared>>
pub fn get_font(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Option<Ref<Font, Shared>>
Returns a font from assigned Theme with given name
and associated with Control of given type
.
Default Arguments
type
-""
The node’s global position, relative to the world (usually to the top-left corner of the window).
Returns the position and size of the control relative to the top-left corner of the screen. See [member rect_position] and [member rect_size].
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.
Tells the parent Container nodes how they should resize and place the node on the X axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
pub fn get_icon(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Option<Ref<Texture, Shared>>
pub fn get_icon(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Option<Ref<Texture, Shared>>
Returns an icon from assigned Theme with given name
and associated with Control of given type
.
Default Arguments
type
-""
Distance between the node’s top edge and its parent control, based on [member anchor_top]. Margins 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. Margins update automatically when you move or resize the node.
Returns the minimum size for this control. See [member rect_min_size].
Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. Also controls whether the control can receive the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what each does.
Returns the width/height occupied in the parent control.
Returns the parent control node.
By default, the node’s pivot is its top-left corner. When you change its [member rect_scale], it will scale around this pivot. Set this property to [member rect_size] / 2 to center the pivot in the node’s rectangle.
The node’s position, relative to its parent. It corresponds to the rectangle’s top-left corner. The property is not affected by [member rect_pivot_offset].
Returns the position and size of the control relative to the top-left corner of the parent Control. See [member rect_position] and [member rect_size].
Returns the rotation (in radians).
The node’s rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot’s position.
The node’s scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset]. The Control’s [member hint_tooltip] 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 [url=https://docs.godotengine.org/en/latest/tutorials/viewports/multiple_resolutions.html]documentation[/url] 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 instanced. To set the Control’s scale when it’s instanced, wait for one frame using yield(get_tree(), "idle_frame")
then set its [member rect_scale] property.
The size of the node’s bounding rectangle, in pixels. Container nodes update this property automatically.
If the node and at least one of its neighbours uses the [constant SIZE_EXPAND] size flag, the parent Container will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbour a ratio of 1, this node will take two thirds of the available space.
pub fn get_stylebox(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Option<Ref<StyleBox, Shared>>
pub fn get_stylebox(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> Option<Ref<StyleBox, Shared>>
Returns a StyleBox from assigned Theme with given name
and associated with Control of given type
.
Default Arguments
type
-""
Returns the tooltip, which will appear when the cursor is resting over this control. See [member hint_tooltip].
Default Arguments
at_position
-Vector2( 0, 0 )
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.
Tells the parent Container nodes how they should resize and place the node on the Y axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
Sample code is GDScript unless otherwise noted.
Creates an InputEventMouseButton that attempts to click the control. If the event is received, the control acquires focus.
func _process(delta):
grab_click_focus() #when clicking another Control node, this node will be clicked instead
Steal the focus from another control and become the focused control (see [member focus_mode]).
pub fn has_color(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
pub fn has_color(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
Returns true
if Color with given name
and associated with Control of given type
exists in assigned Theme.
Default Arguments
type
-""
pub fn has_constant(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
pub fn has_constant(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
Returns true
if constant with given name
and associated with Control of given type
exists in assigned Theme.
Default Arguments
type
-""
Returns true
if constant with given name
has a valid override in this Control node.
Returns true
if this is the current focused control. See [member focus_mode].
pub fn has_font(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
pub fn has_font(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
Returns true
if font with given name
and associated with Control of given type
exists in assigned Theme.
Default Arguments
type
-""
Returns true
if font with given name
has a valid override in this Control node.
pub fn has_icon(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
pub fn has_icon(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
Returns true
if icon with given name
and associated with Control of given type
exists in assigned Theme.
Default Arguments
type
-""
Returns true
if icon with given name
has a valid override in this Control node.
pub fn has_stylebox(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
pub fn has_stylebox(
&self,
name: impl Into<GodotString>,
node_type: impl Into<GodotString>
) -> bool
Returns true
if StyleBox with given name
and associated with Control of given type
exists in assigned Theme.
Default Arguments
type
-""
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.
Invalidates the size cache in this node and in parent nodes up to toplevel. Intended to be used with [method get_minimum_size] when the return value is changed. Setting [member rect_min_size] directly calls this method automatically.
Give up the focus. No other control will be able to receive keyboard input.
Sets the anchor identified by margin
constant from [enum Margin] enum to value anchor
. A setter method for [member anchor_bottom], [member anchor_left], [member anchor_right] and [member anchor_top].
If keep_margin
is true
, margins aren’t updated after this operation.
If push_opposite_anchor
is true
and the opposite anchor overlaps this anchor, the opposite one will have its value overridden. For example, when setting left anchor to 1 and the right anchor has value of 0.5, the right anchor will also get value of 1. If push_opposite_anchor
was false
, the left anchor would get value 0.5.
Default Arguments
keep_margin
-false
push_opposite_anchor
-true
Works the same as [method set_anchor], but instead of keep_margin
argument and automatic update of margin, it allows to set the margin offset yourself (see [method set_margin]).
Default Arguments
push_opposite_anchor
-false
Sets both anchor preset and margin preset. See [method set_anchors_preset] and [method set_margins_preset].
Default Arguments
resize_mode
-0
margin
-0
Sets the anchors to a preset
from [enum Control.LayoutPreset] enum. This is code equivalent of using the Layout menu in 2D editor.
If keep_margins
is true
, control’s position will also be updated.
Default Arguments
keep_margins
-false
Sets [member margin_left] and [member margin_top] at the same time. Equivalent of changing [member rect_position].
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.
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.
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.
Sample code is GDScript unless otherwise noted.
Forwards the handling of this control’s drag and drop to target
control.
Forwarding can be implemented in the target control similar to the methods [method get_drag_data], [method can_drop_data], and [method drop_data] but with two differences:
- The function name must be suffixed with _fw
- The function must take an extra argument that is the control doing the forwarding
# ThisControl.gd
extends Control
func _ready():
set_drag_forwarding(target_control)
# TargetControl.gd
extends Control
func can_drop_data_fw(position, data, from_control):
return true
func drop_data_fw(position, data, from_control):
my_handle_data(data)
func get_drag_data_fw(position, from_control):
set_drag_preview(my_preview)
return my_data()
Sample code is GDScript unless otherwise noted.
Shows the given control at the mouse pointer. A good time to call this method is in [method get_drag_data]. The control must not be in the scene tree.
export (Color, RGBA) var color = Color(1, 0, 0, 1)
func get_drag_data(position):
# Use a control that is not in the tree
var cpb = ColorPickerButton.new()
cpb.color = color
cpb.rect_size = Vector2(50, 50)
set_drag_preview(cpb)
return color
Sets [member margin_right] and [member margin_bottom] at the same time.
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.
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.
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.
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.
Sets the [member rect_global_position] to given position
.
If keep_margins
is true
, control’s anchors will be updated instead of margins.
Default Arguments
keep_margins
-false
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.
Tells the parent Container nodes how they should resize and place the node on the X axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
Distance between the node’s top edge and its parent control, based on [member anchor_top]. Margins 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. Margins update automatically when you move or resize the node.
Sets the margins to a preset
from [enum Control.LayoutPreset] enum. This is code equivalent of using the Layout menu in 2D editor.
Use parameter resize_mode
with constants from [enum Control.LayoutPresetMode] to better determine the resulting size of the Control. Constant size will be ignored if used with presets that change size, e.g. PRESET_LEFT_WIDE
.
Use parameter margin
to determine the gap between the Control and the edges.
Default Arguments
resize_mode
-0
margin
-0
Controls whether the control will be able to receive mouse button input events through [method _gui_input] and how these events should be handled. Also controls whether the control can receive the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what each does.
By default, the node’s pivot is its top-left corner. When you change its [member rect_scale], it will scale around this pivot. Set this property to [member rect_size] / 2 to center the pivot in the node’s rectangle.
Sets the [member rect_position] to given position
.
If keep_margins
is true
, control’s anchors will be updated instead of margins.
Default Arguments
keep_margins
-false
Sets the rotation (in radians).
The node’s rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot’s position.
The node’s scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset]. The Control’s [member hint_tooltip] 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 [url=https://docs.godotengine.org/en/latest/tutorials/viewports/multiple_resolutions.html]documentation[/url] 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 instanced. To set the Control’s scale when it’s instanced, wait for one frame using yield(get_tree(), "idle_frame")
then set its [member rect_scale] property.
Sets the size (see [member rect_size]).
If keep_margins
is true
, control’s anchors will be updated instead of margins.
Default Arguments
keep_margins
-false
If the node and at least one of its neighbours uses the [constant SIZE_EXPAND] size flag, the parent Container will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbour a ratio of 1, this node will take two thirds of the available space.
Changes the tooltip text. The tooltip appears when the user’s mouse cursor stays idle over this control for a few moments, provided that the [member mouse_filter] property is not [constant MOUSE_FILTER_IGNORE]. You can change the time required for the tooltip to appear with gui/timers/tooltip_delay_sec
option in Project Settings.
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.
Tells the parent Container nodes how they should resize and place the node on the Y axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does.
Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
If exclusive
is true
, other controls will not receive input and clicking outside this control will not close it.
Default Arguments
exclusive
-false
Moves the mouse cursor to to_position
, relative to [member rect_position] of this Control.
Trait Implementations
type RefKind = ManuallyManaged
type RefKind = ManuallyManaged
Creates an explicitly null reference of Self
as a method argument. This makes type
inference easier for the compiler compared to Option
. Read more
Creates a new instance of Self
using a zero-argument constructor, as a Unique
reference. Read more
Performs a dynamic reference downcast to target type. Read more
Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
Creates a persistent reference to the same Godot object with shared thread access. Read more
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
Creates a persistent reference to the same Godot object with thread-local thread access. Read more
Creates a persistent reference to the same Godot object with unique access. Read more
Recovers a instance ID previously returned by Object::get_instance_id
if the object is
still alive. See also TRef::try_from_instance_id
. Read more
Auto Trait Implementations
impl RefUnwindSafe for TextEdit
impl UnwindSafe for TextEdit