summaryrefslogtreecommitdiff
path: root/doc/classes/LineEdit.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/LineEdit.xml')
-rw-r--r--doc/classes/LineEdit.xml140
1 files changed, 73 insertions, 67 deletions
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index 7adf19632e..834b5a41db 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -32,92 +32,80 @@
</tutorials>
<methods>
<method name="clear">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Erases the [LineEdit]'s [member text].
</description>
</method>
<method name="clear_opentype_features">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Removes all OpenType features.
</description>
</method>
<method name="delete_char_at_caret">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Deletes one character at the caret's current position (equivalent to pressing [kbd]Delete[/kbd]).
</description>
</method>
<method name="delete_text">
- <return type="void">
- </return>
- <argument index="0" name="from_column" type="int">
- </argument>
- <argument index="1" name="to_column" type="int">
- </argument>
+ <return type="void" />
+ <argument index="0" name="from_column" type="int" />
+ <argument index="1" name="to_column" type="int" />
<description>
Deletes a section of the [member text] going from position [code]from_column[/code] to [code]to_column[/code]. Both parameters should be within the text's length.
</description>
</method>
<method name="deselect">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Clears the current selection.
</description>
</method>
<method name="get_menu" qualifiers="const">
- <return type="PopupMenu">
- </return>
+ <return type="PopupMenu" />
<description>
Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit].
</description>
</method>
<method name="get_opentype_feature" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="tag" type="String">
- </argument>
+ <return type="int" />
+ <argument index="0" name="tag" type="String" />
<description>
Returns OpenType feature [code]tag[/code].
</description>
</method>
<method name="get_scroll_offset" qualifiers="const">
- <return type="int">
- </return>
+ <return type="int" />
<description>
Returns the scroll offset due to [member caret_column], as a number of characters.
</description>
</method>
<method name="insert_text_at_caret">
- <return type="void">
- </return>
- <argument index="0" name="text" type="String">
- </argument>
+ <return type="void" />
+ <argument index="0" name="text" type="String" />
<description>
Inserts [code]text[/code] at the caret. If the resulting value is longer than [member max_length], nothing happens.
</description>
</method>
+ <method name="is_menu_visible" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns whether the menu is visible. Use this instead of [code]get_menu().visible[/code] to improve performance (so the creation of the menu is avoided).
+ </description>
+ </method>
<method name="menu_option">
- <return type="void">
- </return>
- <argument index="0" name="option" type="int">
- </argument>
+ <return type="void" />
+ <argument index="0" name="option" type="int" />
<description>
Executes a given action as defined in the [enum MenuItems] enum.
</description>
</method>
<method name="select">
- <return type="void">
- </return>
- <argument index="0" name="from" type="int" default="0">
- </argument>
- <argument index="1" name="to" type="int" default="-1">
- </argument>
+ <return type="void" />
+ <argument index="0" name="from" type="int" default="0" />
+ <argument index="1" name="to" type="int" default="-1" />
<description>
Selects characters inside [LineEdit] between [code]from[/code] and [code]to[/code]. By default, [code]from[/code] is at the beginning and [code]to[/code] at the end.
[codeblocks]
@@ -137,19 +125,15 @@
</description>
</method>
<method name="select_all">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Selects the whole [String].
</description>
</method>
<method name="set_opentype_feature">
- <return type="void">
- </return>
- <argument index="0" name="tag" type="String">
- </argument>
- <argument index="1" name="value" type="int">
- </argument>
+ <return type="void" />
+ <argument index="0" name="tag" type="String" />
+ <argument index="1" name="value" type="int" />
<description>
Returns OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
</description>
@@ -169,6 +153,7 @@
The caret's column position inside the [LineEdit]. When set, the text may scroll to accommodate it.
</member>
<member name="caret_force_displayed" type="bool" setter="set_caret_force_displayed" getter="is_caret_force_displayed" default="false">
+ If [code]true[/code], the [LineEdit] will always show the caret, even if focus is lost.
</member>
<member name="caret_mid_grapheme" type="bool" setter="set_caret_mid_grapheme_enabled" getter="is_caret_mid_grapheme_enabled" default="false">
Allow moving caret, selecting and removing the individual composite character components.
@@ -195,6 +180,28 @@
</member>
<member name="max_length" type="int" setter="set_max_length" getter="get_max_length" default="0">
Maximum amount of characters that can be entered inside the [LineEdit]. If [code]0[/code], there is no limit.
+ When a limit is defined, characters that would exceed [member max_length] are truncated. This happens both for existing [member text] contents when setting the max length, or for new text inserted in the [LineEdit], including pasting. If any input text is truncated, the [signal text_change_rejected] signal is emitted with the truncated substring as parameter.
+ [b]Example:[/b]
+ [codeblocks]
+ [gdscript]
+ text = "Hello world"
+ max_length = 5
+ # `text` becomes "Hello".
+ max_length = 10
+ text += " goodbye"
+ # `text` becomes "Hello good".
+ # `text_change_rejected` is emitted with "bye" as parameter.
+ [/gdscript]
+ [csharp]
+ Text = "Hello world";
+ MaxLength = 5;
+ // `Text` becomes "Hello".
+ MaxLength = 10;
+ Text += " goodbye";
+ // `Text` becomes "Hello good".
+ // `text_change_rejected` is emitted with "bye" as parameter.
+ [/csharp]
+ [/codeblocks]
</member>
<member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" override="true" enum="Control.CursorShape" default="1" />
<member name="placeholder_alpha" type="float" setter="set_placeholder_alpha" getter="get_placeholder_alpha" default="0.6">
@@ -221,7 +228,7 @@
<member name="structured_text_bidi_override" type="int" setter="set_structured_text_bidi_override" getter="get_structured_text_bidi_override" enum="Control.StructuredTextParser" default="0">
Set BiDi algorithm override for the structured text.
</member>
- <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[ ]">
+ <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[]">
Set additional options for BiDi override.
</member>
<member name="text" type="String" setter="set_text" getter="get_text" default="&quot;&quot;">
@@ -237,20 +244,19 @@
</members>
<signals>
<signal name="text_change_rejected">
+ <argument index="0" name="rejected_substring" type="String" />
<description>
- Emitted when trying to append text that would overflow the [member max_length].
+ Emitted when appending text that overflows the [member max_length]. The appended text is truncated to fit [member max_length], and the part that couldn't fit is passed as the [code]rejected_substring[/code] argument.
</description>
</signal>
<signal name="text_changed">
- <argument index="0" name="new_text" type="String">
- </argument>
+ <argument index="0" name="new_text" type="String" />
<description>
Emitted when the text changes.
</description>
</signal>
- <signal name="text_entered">
- <argument index="0" name="new_text" type="String">
- </argument>
+ <signal name="text_submitted">
+ <argument index="0" name="new_text" type="String" />
<description>
Emitted when the user presses [constant KEY_ENTER] on the [LineEdit].
</description>
@@ -359,52 +365,52 @@
</constant>
</constants>
<theme_items>
- <theme_item name="caret_color" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )">
+ <theme_item name="caret_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Color of the [LineEdit]'s caret (text cursor).
</theme_item>
- <theme_item name="clear" type="Texture2D">
+ <theme_item name="clear" data_type="icon" type="Texture2D">
Texture for the clear button. See [member clear_button_enabled].
</theme_item>
- <theme_item name="clear_button_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
+ <theme_item name="clear_button_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Color used as default tint for the clear button.
</theme_item>
- <theme_item name="clear_button_color_pressed" type="Color" default="Color( 1, 1, 1, 1 )">
+ <theme_item name="clear_button_color_pressed" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Color used for the clear button when it's pressed.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
Background used when [LineEdit] has GUI focus.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
Font used for the text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default font color.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color( 1, 1, 1, 1 )">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [LineEdit].
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color( 0, 0, 0, 1 )">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
Font color for selected text (inside the selection rectangle).
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [LineEdit]'s text.
</theme_item>
- <theme_item name="font_uneditable_color" type="Color" default="Color( 0.88, 0.88, 0.88, 0.5 )">
+ <theme_item name="font_uneditable_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
Font color when editing is disabled.
</theme_item>
- <theme_item name="minimum_character_width" type="int" default="4">
+ <theme_item name="minimum_character_width" data_type="constant" type="int" default="4">
Minimum horizontal space for the text (not counting the clear button and content margins). This value is measured in count of 'M' characters (i.e. this amount of 'M' characters can be displayed without scrolling).
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Default background for the [LineEdit].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="read_only" type="StyleBox">
+ <theme_item name="read_only" data_type="style" type="StyleBox">
Background used when [LineEdit] is in read-only mode ([member editable] is set to [code]false[/code]).
</theme_item>
- <theme_item name="selection_color" type="Color" default="Color( 0.49, 0.49, 0.49, 1 )">
+ <theme_item name="selection_color" data_type="color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
Color of the selection rectangle.
</theme_item>
</theme_items>