2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2019-04-01 18:33:56 +08:00
<class name= "LineEdit" inherits= "Control" category= "Core" version= "3.2" >
2017-09-13 04:42:36 +08:00
<brief_description >
2019-04-04 04:29:06 +08:00
Control that provides single-line string editing.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2019-04-04 04:29:06 +08:00
LineEdit provides a single-line string editor, used for text fields. It features many built-in shortcuts which will always be available:
- Ctrl + C: Copy
- Ctrl + X: Cut
- Ctrl + V or Ctrl + Y: Paste/"yank"
- Ctrl + Z: Undo
- Ctrl + Shift + Z: Redo
- Ctrl + U: Delete text from the cursor position to the beginning of the line
- Ctrl + K: Delete text from the cursor position to the end of the line
- Ctrl + A: Select all text
- Up/Down arrow: Move the cursor to the beginning/end of the line
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "append_at_cursor" >
<return type= "void" >
</return>
<argument index= "0" name= "text" type= "String" >
</argument>
<description >
2017-10-28 06:00:22 +08:00
Adds [code]text[/code] after the cursor. If the resulting value is longer than [member max_length], nothing happens.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "clear" >
<return type= "void" >
</return>
<description >
2019-03-30 06:37:35 +08:00
Erases the [LineEdit] text.
2017-09-13 04:42:36 +08:00
</description>
</method>
2017-12-18 01:40:44 +08:00
<method name= "deselect" >
<return type= "void" >
</return>
<description >
Clears the current selection.
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_menu" qualifiers= "const" >
<return type= "PopupMenu" >
</return>
<description >
2019-03-30 06:37:35 +08:00
Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "menu_option" >
<return type= "void" >
</return>
<argument index= "0" name= "option" type= "int" >
</argument>
<description >
2019-12-07 06:09:20 +08:00
Executes a given action as defined in the [enum MenuItems] enum.
2017-09-13 04:42:36 +08:00
</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>
<description >
2019-06-22 07:04:47 +08:00
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.
2017-09-13 04:42:36 +08:00
[codeblock]
2017-10-28 06:00:22 +08:00
text = "Welcome"
2019-06-22 07:04:47 +08:00
select() # Will select "Welcome"
select(4) # Will select "ome"
select(2, 5) # Will select "lco"
2017-09-13 04:42:36 +08:00
[/codeblock]
</description>
</method>
<method name= "select_all" >
<return type= "void" >
</return>
<description >
2017-10-28 06:00:22 +08:00
Selects the whole [String].
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "align" type= "int" setter= "set_align" getter= "get_align" enum= "LineEdit.Align" default= "0" >
2019-12-07 06:09:20 +08:00
Text alignment as defined in the [enum Align] enum.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "caret_blink" type= "bool" setter= "cursor_set_blink_enabled" getter= "cursor_get_blink_enabled" default= "false" >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the caret (visual cursor) blinks.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "caret_blink_speed" type= "float" setter= "cursor_set_blink_speed" getter= "cursor_get_blink_speed" default= "0.65" >
2017-10-28 06:00:22 +08:00
Duration (in seconds) of a caret's blinking cycle.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "caret_position" type= "int" setter= "set_cursor_position" getter= "get_cursor_position" default= "0" >
2019-03-30 06:37:35 +08:00
The cursor's position inside the [LineEdit]. When set, the text may scroll to accommodate it.
2018-01-12 06:38:35 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "clear_button_enabled" type= "bool" setter= "set_clear_button_enabled" getter= "is_clear_button_enabled" default= "false" >
2020-01-09 05:51:16 +08:00
If [code]true[/code], the [LineEdit] will show a clear button if [code]text[/code] is not empty, which can be used to clear the text quickly.
2018-08-21 06:35:30 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "context_menu_enabled" type= "bool" setter= "set_context_menu_enabled" getter= "is_context_menu_enabled" default= "true" >
2019-06-22 07:04:47 +08:00
If [code]true[/code], the context menu will appear when right-clicked.
2017-11-13 16:24:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "editable" type= "bool" setter= "set_editable" getter= "is_editable" default= "true" >
2018-12-20 20:46:54 +08:00
If [code]false[/code], existing text cannot be modified and new text cannot be added.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "expand_to_text_length" type= "bool" setter= "set_expand_to_text_length" getter= "get_expand_to_text_length" default= "false" >
2019-03-30 06:37:35 +08:00
If [code]true[/code], the [LineEdit] width will increase to stay longer than the [member text]. It will [b]not[/b] compress if the [member text] is shortened.
2017-09-13 04:42:36 +08:00
</member>
2019-09-24 19:34:03 +08:00
<member name= "focus_mode" type= "int" setter= "set_focus_mode" getter= "get_focus_mode" override= "true" enum= "Control.FocusMode" default= "2" />
2019-06-29 18:38:01 +08:00
<member name= "max_length" type= "int" setter= "set_max_length" getter= "get_max_length" default= "0" >
2019-03-30 06:37:35 +08:00
Maximum amount of characters that can be entered inside the [LineEdit]. If [code]0[/code], there is no limit.
2017-09-13 04:42:36 +08:00
</member>
2019-09-24 19:34:03 +08:00
<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" />
2019-06-29 18:38:01 +08:00
<member name= "placeholder_alpha" type= "float" setter= "set_placeholder_alpha" getter= "get_placeholder_alpha" default= "0.6" >
2017-10-28 06:00:22 +08:00
Opacity of the [member placeholder_text]. From [code]0[/code] to [code]1[/code].
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "placeholder_text" type= "String" setter= "set_placeholder" getter= "get_placeholder" default= """" >
2019-03-30 06:37:35 +08:00
Text shown when the [LineEdit] is empty. It is [b]not[/b] the [LineEdit]'s default value (see [member text]).
2017-09-13 04:42:36 +08:00
</member>
2019-09-09 09:46:57 +08:00
<member name= "right_icon" type= "Texture" setter= "set_right_icon" getter= "get_right_icon" >
Sets the icon that will appear in the right end of the [LineEdit] if there's no [member text], or always, if [member clear_button_enabled] is set to [code]false[/code].
</member>
2019-06-29 18:38:01 +08:00
<member name= "secret" type= "bool" setter= "set_secret" getter= "is_secret" default= "false" >
2018-04-29 02:24:48 +08:00
If [code]true[/code], every character is replaced with the secret character (see [member secret_character]).
</member>
2019-06-29 18:38:01 +08:00
<member name= "secret_character" type= "String" setter= "set_secret_character" getter= "get_secret_character" default= ""*"" >
2018-04-29 02:24:48 +08:00
The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.
2017-09-13 04:42:36 +08:00
</member>
2019-09-24 17:44:48 +08:00
<member name= "selecting_enabled" type= "bool" setter= "set_selecting_enabled" getter= "is_selecting_enabled" default= "true" >
2020-01-09 05:51:16 +08:00
If [code]false[/code], it's impossible to select the text using mouse nor keyboard.
2019-09-24 17:44:48 +08:00
</member>
<member name= "shortcut_keys_enabled" type= "bool" setter= "set_shortcut_keys_enabled" getter= "is_shortcut_keys_enabled" default= "true" >
2020-01-09 05:51:16 +08:00
If [code]false[/code], using shortcuts will be disabled.
2019-09-24 17:44:48 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "text" type= "String" setter= "set_text" getter= "get_text" default= """" >
2019-03-30 06:37:35 +08:00
String value of the [LineEdit].
2017-09-13 04:42:36 +08:00
</member>
</members>
<signals >
2020-01-12 21:30:21 +08:00
<signal name= "text_change_rejected" >
<description >
Emitted when trying to append text that would overflow the [member max_length].
</description>
</signal>
2017-09-13 04:42:36 +08:00
<signal name= "text_changed" >
2018-01-09 23:39:43 +08:00
<argument index= "0" name= "new_text" type= "String" >
2017-09-13 04:42:36 +08:00
</argument>
<description >
2017-10-28 06:00:22 +08:00
Emitted when the text changes.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "text_entered" >
2018-01-09 23:39:43 +08:00
<argument index= "0" name= "new_text" type= "String" >
2017-09-13 04:42:36 +08:00
</argument>
<description >
2019-03-30 06:37:35 +08:00
Emitted when the user presses [constant KEY_ENTER] on the [LineEdit].
2017-09-13 04:42:36 +08:00
</description>
</signal>
</signals>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "ALIGN_LEFT" value= "0" enum= "Align" >
2019-06-22 07:04:47 +08:00
Aligns the text on the left-hand side of the [LineEdit].
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "ALIGN_CENTER" value= "1" enum= "Align" >
2019-03-30 06:37:35 +08:00
Centers the text in the middle of the [LineEdit].
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "ALIGN_RIGHT" value= "2" enum= "Align" >
2019-06-22 07:04:47 +08:00
Aligns the text on the right-hand side of the [LineEdit].
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "ALIGN_FILL" value= "3" enum= "Align" >
2019-03-30 06:37:35 +08:00
Stretches whitespaces to fit the [LineEdit]'s width.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_CUT" value= "0" enum= "MenuItems" >
2019-01-07 17:02:04 +08:00
Cuts (copies and clears) the selected text.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_COPY" value= "1" enum= "MenuItems" >
2017-10-28 06:00:22 +08:00
Copies the selected text.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_PASTE" value= "2" enum= "MenuItems" >
2017-10-28 06:00:22 +08:00
Pastes the clipboard text over the selected text (or at the cursor's position).
2019-05-31 21:27:53 +08:00
Non-printable escape characters are automatically stripped from the OS clipboard via [method String.strip_escapes].
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_CLEAR" value= "3" enum= "MenuItems" >
2019-03-30 06:37:35 +08:00
Erases the whole [LineEdit] text.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_SELECT_ALL" value= "4" enum= "MenuItems" >
2019-03-30 06:37:35 +08:00
Selects the whole [LineEdit] text.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_UNDO" value= "5" enum= "MenuItems" >
2017-10-28 06:00:22 +08:00
Undoes the previous action.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_REDO" value= "6" enum= "MenuItems" >
2018-10-13 23:36:30 +08:00
Reverse the last undo action.
2017-11-13 16:24:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MENU_MAX" value= "7" enum= "MenuItems" >
2019-06-27 17:10:53 +08:00
Represents the size of the [enum MenuItems] enum.
2017-09-13 04:42:36 +08:00
</constant>
</constants>
<theme_items >
2018-08-21 06:35:30 +08:00
<theme_item name= "clear" type= "Texture" >
2020-01-09 05:51:16 +08:00
Texture for the clear button. See [member clear_button_enabled].
2018-08-21 06:35:30 +08:00
</theme_item>
2019-07-09 15:13:00 +08:00
<theme_item name= "clear_button_color" type= "Color" default= "Color( 0.88, 0.88, 0.88, 1 )" >
2020-01-09 05:51:16 +08:00
Color used as default tint for the clear button.
2018-08-21 06:35:30 +08:00
</theme_item>
2019-06-29 18:38:01 +08:00
<theme_item name= "clear_button_color_pressed" type= "Color" default= "Color( 1, 1, 1, 1 )" >
2020-01-09 05:51:16 +08:00
Color used for the clear button when it's pressed.
2018-08-21 06:35:30 +08:00
</theme_item>
2019-07-09 15:13:00 +08:00
<theme_item name= "cursor_color" type= "Color" default= "Color( 0.94, 0.94, 0.94, 1 )" >
2020-01-09 05:51:16 +08:00
Color of the [LineEdit]'s visual cursor (caret).
2017-09-13 04:42:36 +08:00
</theme_item>
<theme_item name= "focus" type= "StyleBox" >
2020-01-09 05:51:16 +08:00
Background used when [LineEdit] has GUI focus.
2017-09-13 04:42:36 +08:00
</theme_item>
<theme_item name= "font" type= "Font" >
2020-01-09 05:51:16 +08:00
Font used for the text.
2017-09-13 04:42:36 +08:00
</theme_item>
2019-07-09 15:13:00 +08:00
<theme_item name= "font_color" type= "Color" default= "Color( 0.88, 0.88, 0.88, 1 )" >
2020-01-09 05:51:16 +08:00
Default font color.
2017-09-13 04:42:36 +08:00
</theme_item>
2019-06-29 18:38:01 +08:00
<theme_item name= "font_color_selected" type= "Color" default= "Color( 0, 0, 0, 1 )" >
2020-01-09 05:51:16 +08:00
Font color for selected text (inside the selection rectangle).
2017-09-13 04:42:36 +08:00
</theme_item>
2019-07-09 15:13:00 +08:00
<theme_item name= "font_color_uneditable" type= "Color" default= "Color( 0.88, 0.88, 0.88, 0.5 )" >
2020-01-09 05:51:16 +08:00
Font color when editing is disabled.
2019-06-26 22:02:47 +08:00
</theme_item>
2019-06-29 18:38:01 +08:00
<theme_item name= "minimum_spaces" type= "int" default= "12" >
2020-01-09 05:51:16 +08:00
Minimum horizontal space for the text (not counting the clear button and content margins).
2017-09-13 04:42:36 +08:00
</theme_item>
<theme_item name= "normal" type= "StyleBox" >
2020-01-09 05:51:16 +08:00
Default background for the [LineEdit].
2017-09-13 04:42:36 +08:00
</theme_item>
<theme_item name= "read_only" type= "StyleBox" >
2020-01-09 05:51:16 +08:00
Background used when [LineEdit] is in read-only mode ([member editable] is set to [code]false[/code]).
2017-09-13 04:42:36 +08:00
</theme_item>
2019-07-09 15:13:00 +08:00
<theme_item name= "selection_color" type= "Color" default= "Color( 0.49, 0.49, 0.49, 1 )" >
2020-01-09 05:51:16 +08:00
Color of the selection rectangle.
2017-09-13 04:42:36 +08:00
</theme_item>
</theme_items>
</class>