.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the LineEdit.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_LineEdit: LineEdit ======== **Inherits:** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Control that provides single line string editing. Member Functions ---------------- +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`append_at_cursor` **(** :ref:`String` text **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`cursor_get_blink_enabled` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`cursor_get_blink_speed` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`cursor_set_blink_enabled` **(** :ref:`bool` enabled **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`cursor_set_blink_speed` **(** :ref:`float` blink_speed **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_align` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_cursor_position` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_expand_to_text_length` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_max_length` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`PopupMenu` | :ref:`get_menu` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_placeholder` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_placeholder_alpha` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_text` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_editable` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_secret` **(** **)** const | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`menu_option` **(** :ref:`int` option **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`select` **(** :ref:`int` from=0, :ref:`int` to=-1 **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`select_all` **(** **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_align` **(** :ref:`int` align **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_cursor_position` **(** :ref:`int` position **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_editable` **(** :ref:`bool` enabled **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_expand_to_text_length` **(** :ref:`bool` enabled **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_max_length` **(** :ref:`int` chars **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_placeholder` **(** :ref:`String` text **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_placeholder_alpha` **(** :ref:`float` alpha **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_secret` **(** :ref:`bool` enabled **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_text` **(** :ref:`String` text **)** | +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **text_changed** **(** :ref:`String` text **)** When the text changes, this signal is emitted. - **text_entered** **(** :ref:`String` text **)** This signal is emitted when the user presses KEY_ENTER on the :ref:`LineEdit`. This signal is often used as an alternate confirmation mechanism in dialogs. Member Variables ---------------- - :ref:`int` **align** - :ref:`bool` **caret_blink** - :ref:`float` **caret_blink_speed** - :ref:`bool` **editable** - :ref:`bool` **expand_to_len** - :ref:`int` **focus_mode** - :ref:`int` **max_length** - :ref:`float` **placeholder_alpha** - :ref:`String` **placeholder_text** - :ref:`bool` **secret** - :ref:`String` **text** Numeric Constants ----------------- - **ALIGN_LEFT** = **0** --- Align left. - **ALIGN_CENTER** = **1** --- Align center. - **ALIGN_RIGHT** = **2** --- Align right. - **ALIGN_FILL** = **3** --- Align fill. - **MENU_CUT** = **0** --- Cut (Copy and clear). - **MENU_COPY** = **1** --- Copy the selected text. - **MENU_PASTE** = **2** --- Paste the clipboard text over the selected text. - **MENU_CLEAR** = **3** --- Clear the text. - **MENU_SELECT_ALL** = **4** --- Select all text. - **MENU_UNDO** = **5** --- Undo an action. - **MENU_MAX** = **6** Description ----------- LineEdit provides a single line string editor, used for text fields. Member Function Description --------------------------- .. _class_LineEdit_append_at_cursor: - void **append_at_cursor** **(** :ref:`String` text **)** Append text at cursor, scrolling the :ref:`LineEdit` when needed. .. _class_LineEdit_clear: - void **clear** **(** **)** Clear the :ref:`LineEdit` text. .. _class_LineEdit_cursor_get_blink_enabled: - :ref:`bool` **cursor_get_blink_enabled** **(** **)** const Gets whether the line edit caret is blinking. .. _class_LineEdit_cursor_get_blink_speed: - :ref:`float` **cursor_get_blink_speed** **(** **)** const Gets the line edit caret blink speed. .. _class_LineEdit_cursor_set_blink_enabled: - void **cursor_set_blink_enabled** **(** :ref:`bool` enabled **)** Set the line edit caret to blink. .. _class_LineEdit_cursor_set_blink_speed: - void **cursor_set_blink_speed** **(** :ref:`float` blink_speed **)** Set the line edit caret blink speed. Cannot be less then or equal to 0. .. _class_LineEdit_get_align: - :ref:`int` **get_align** **(** **)** const Return the align mode of the :ref:`LineEdit`. .. _class_LineEdit_get_cursor_position: - :ref:`int` **get_cursor_position** **(** **)** const Return the cursor position inside the :ref:`LineEdit`. .. _class_LineEdit_get_expand_to_text_length: - :ref:`bool` **get_expand_to_text_length** **(** **)** const .. _class_LineEdit_get_max_length: - :ref:`int` **get_max_length** **(** **)** const Return the maximum amount of characters the :ref:`LineEdit` can edit. If 0 is returned, no limit exists. .. _class_LineEdit_get_menu: - :ref:`PopupMenu` **get_menu** **(** **)** const Return the :ref:`PopupMenu` of this :ref:`LineEdit`. .. _class_LineEdit_get_placeholder: - :ref:`String` **get_placeholder** **(** **)** const Return the placeholder text. .. _class_LineEdit_get_placeholder_alpha: - :ref:`float` **get_placeholder_alpha** **(** **)** const Return transparency of the placeholder text. .. _class_LineEdit_get_text: - :ref:`String` **get_text** **(** **)** const Return the text in the :ref:`LineEdit`. .. _class_LineEdit_is_editable: - :ref:`bool` **is_editable** **(** **)** const Return the *editable* status of the :ref:`LineEdit` (see :ref:`set_editable`). .. _class_LineEdit_is_secret: - :ref:`bool` **is_secret** **(** **)** const Return the *secret* status of the :ref:`LineEdit` (see :ref:`set_secret`). .. _class_LineEdit_menu_option: - void **menu_option** **(** :ref:`int` option **)** Execute a given action as defined in the MENU\_\* enum. .. _class_LineEdit_select: - void **select** **(** :ref:`int` from=0, :ref:`int` to=-1 **)** Select the text inside :ref:`LineEdit` by the given character positions. ``from`` is default to the beginning. ``to`` is default to the end. :: select() # select all select(5) # select from the fifth character to the end. select(2, 5) # select from the second to the fifth character. .. _class_LineEdit_select_all: - void **select_all** **(** **)** Select the whole string. .. _class_LineEdit_set_align: - void **set_align** **(** :ref:`int` align **)** Set text alignment of the :ref:`LineEdit`. .. _class_LineEdit_set_cursor_position: - void **set_cursor_position** **(** :ref:`int` position **)** Set the cursor position inside the :ref:`LineEdit`, causing it to scroll if needed. .. _class_LineEdit_set_editable: - void **set_editable** **(** :ref:`bool` enabled **)** Set the *editable* status of the :ref:`LineEdit`. When disabled, existing text can't be modified and new text can't be added. .. _class_LineEdit_set_expand_to_text_length: - void **set_expand_to_text_length** **(** :ref:`bool` enabled **)** .. _class_LineEdit_set_max_length: - void **set_max_length** **(** :ref:`int` chars **)** Set the maximum amount of characters the :ref:`LineEdit` can edit, and cropping existing text in case it exceeds that limit. Setting 0 removes the limit. .. _class_LineEdit_set_placeholder: - void **set_placeholder** **(** :ref:`String` text **)** Set the placeholder text. .. _class_LineEdit_set_placeholder_alpha: - void **set_placeholder_alpha** **(** :ref:`float` alpha **)** Set transparency of the placeholder text. .. _class_LineEdit_set_secret: - void **set_secret** **(** :ref:`bool` enabled **)** Set the *secret* status of the :ref:`LineEdit`. When enabled, every character is displayed as "\*". .. _class_LineEdit_set_text: - void **set_text** **(** :ref:`String` text **)** Set the text in the :ref:`LineEdit`, clearing the existing one and the selection.