Struct gdnative_bindings_lily::RichTextLabel [−][src]
pub struct RichTextLabel { /* fields omitted */ }
Expand description
core class RichTextLabel
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.
RichTextLabel
is a reference-only type. Persistent references can
only exist in the unsafe Ref<RichTextLabel>
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
RichTextLabel 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
.
Adds an image’s opening and closing tags to the tag stack, optionally providing a width
and height
to resize the image.
If width
or height
is set to 0, the image size will be adjusted in order to keep the original aspect ratio.
Default Arguments
width
-0
height
-0
Adds raw non-BBCode-parsed text to the tag stack.
Parses bbcode
and adds tags to the tag stack as needed. Returns the result of the parsing, [constant OK] if successful.
The label’s text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
Note: It is unadvised to use +=
operator with bbcode_text
(e.g. bbcode_text += "some string"
) as it replaces the whole text and can cause slowdowns. Use [method append_bbcode] for adding text instead.
Returns the height of the content.
The currently installed custom effects. This is an array of RichTextEffects. To add a custom effect, it’s more convenient to use [method install_effect].
Returns the total number of newlines in the tag stack’s text tags. Considers wrapped text as one line.
The range of characters to display, as a [float] between 0.0 and 1.0. When assigned an out of range value, it’s the same as assigning 1.0. Note: Setting this property updates [member visible_characters] based on current [method get_total_character_count].
The number of spaces associated with a single tab length. Does not affect \t
in text tags, only indent tags.
The raw text of the label. When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse BBCodes. Does not modify [member bbcode_text].
Returns the total number of characters from text tags. Does not include BBCodes.
Returns the vertical scrollbar.
The restricted number of characters to display in the label. If -1
, all characters will be displayed.
Returns the number of visible lines.
Installs a custom effect. effect
should be a valid RichTextEffect.
If true
, the label’s height will be automatically updated to fit its content.
Note: This property is used as a workaround to fix issues with RichTextLabel in Containers, but it’s unreliable in some cases and will be removed in future versions.
If true
, the label underlines meta tags such as [url]{text}[/url]
.
If true
, the label uses the custom font color.
If true
, the scrollbar is visible. Setting this to false
does not block scrolling completely. See [method scroll_to_line].
If true
, the window scrolls down to display new content automatically.
If true
, the label allows text selection.
If true
, the label uses BBCode formatting.
The assignment version of [method append_bbcode]. Clears the tag stack and inserts the new content. Returns [constant OK] if parses bbcode
successfully.
Parses BBCode parameter expressions
into a dictionary.
Terminates the current tag. Use after push_*
methods to close BBCodes manually. Does not need to follow add_*
methods.
Adds an [align]
tag based on the given align
value. See [enum Align] for possible values.
Adds a [font]
tag with a bold font to the tag stack. This is the same as adding a **
tag if not currently in a [i]
tag.
Adds a [font]
tag with a bold italics font to the tag stack.
Adds a [cell]
tag to the tag stack. Must be inside a [table]
tag. See [method push_table] for details.
Adds a [color]
tag to the tag stack.
Adds a [font]
tag to the tag stack. Overrides default fonts for its duration.
Adds an [indent]
tag to the tag stack. Multiplies level
by current [member tab_size] to determine new margin length.
Adds a [font]
tag with a italics font to the tag stack. This is the same as adding a [i]
tag if not currently in a **
tag.
Adds a [list]
tag to the tag stack. Similar to the BBCodes [ol]
or [ul]
, but supports more list types. Not fully implemented!
Adds a [meta]
tag to the tag stack. Similar to the BBCode [url=something]{text}[/url]
, but supports non-String metadata types.
Adds a [font]
tag with a normal font to the tag stack.
Adds a [s]
tag to the tag stack.
Adds a [table=columns]
tag to the tag stack.
Adds a [u]
tag to the tag stack.
Removes a line of content from the label. Returns true
if the line exists.
The line
argument is the index of the line to remove, it can take values in the interval [0, get_line_count() - 1]
.
Scrolls the window’s top line to match line
.
The label’s text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
Note: It is unadvised to use +=
operator with bbcode_text
(e.g. bbcode_text += "some string"
) as it replaces the whole text and can cause slowdowns. Use [method append_bbcode] for adding text instead.
The currently installed custom effects. This is an array of RichTextEffects. To add a custom effect, it’s more convenient to use [method install_effect].
If true
, the label’s height will be automatically updated to fit its content.
Note: This property is used as a workaround to fix issues with RichTextLabel in Containers, but it’s unreliable in some cases and will be removed in future versions.
If true
, the label underlines meta tags such as [url]{text}[/url]
.
If true
, the label uses the custom font color.
The range of characters to display, as a [float] between 0.0 and 1.0. When assigned an out of range value, it’s the same as assigning 1.0. Note: Setting this property updates [member visible_characters] based on current [method get_total_character_count].
If true
, the scrollbar is visible. Setting this to false
does not block scrolling completely. See [method scroll_to_line].
If true
, the window scrolls down to display new content automatically.
If true
, the label allows text selection.
The number of spaces associated with a single tab length. Does not affect \t
in text tags, only indent tags.
Edits the selected column’s expansion options. If expand
is true
, the column expands in proportion to its expansion ratio versus the other columns’ ratios.
For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively.
If expand
is false
, the column will not contribute to the total ratio.
The raw text of the label. When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse BBCodes. Does not modify [member bbcode_text].
If true
, the label uses BBCode formatting.
The restricted number of characters to display in the label. If -1
, all characters will be displayed.
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 RichTextLabel
impl !Send for RichTextLabel
impl !Sync for RichTextLabel
impl Unpin for RichTextLabel
impl UnwindSafe for RichTextLabel