.. 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` **(** **)** | +------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`deselect` **(** **)** | +------------------------------------+------------------------------------------------------------------------------------------------------------+ | :ref:`PopupMenu` | :ref:`get_menu` **(** **)** const | +------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`menu_option` **(** :ref:`int` option **)** | +------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`select` **(** :ref:`int` from=0, :ref:`int` to=-1 **)** | +------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`select_all` **(** **)** | +------------------------------------+------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_LineEdit_text_changed: - **text_changed** **(** :ref:`String` new_text **)** Emitted when the text changes. .. _class_LineEdit_text_entered: - **text_entered** **(** :ref:`String` new_text **)** Emitted when the user presses KEY_ENTER on the ``LineEdit``. Member Variables ---------------- .. _class_LineEdit_align: - :ref:`Align` **align** - Text alignment as defined in the ALIGN\_\* enum. .. _class_LineEdit_caret_blink: - :ref:`bool` **caret_blink** - If ``true`` the caret (visual cursor) blinks. .. _class_LineEdit_caret_blink_speed: - :ref:`float` **caret_blink_speed** - Duration (in seconds) of a caret's blinking cycle. .. _class_LineEdit_caret_position: - :ref:`int` **caret_position** - The cursor's position inside the ``LineEdit``. When set, the text may scroll to accommodate it. .. _class_LineEdit_context_menu_enabled: - :ref:`bool` **context_menu_enabled** - If ``true`` the context menu will appear when right clicked. .. _class_LineEdit_editable: - :ref:`bool` **editable** - If ``false`` existing text cannot be modified and new text cannot be added. .. _class_LineEdit_expand_to_text_length: - :ref:`bool` **expand_to_text_length** - If ``true`` the :ref:`LineEdit` width will increase to stay longer than the :ref:`text`. It will **not** compress if the :ref:`text` is shortened. .. _class_LineEdit_focus_mode: - :ref:`FocusMode` **focus_mode** - Defines how the :ref:`LineEdit` can grab focus (Keyboard and mouse, only keyboard, or none). See ``enum FocusMode`` in :ref:`Control` for details. .. _class_LineEdit_max_length: - :ref:`int` **max_length** - Maximum amount of characters that can be entered inside the :ref:`LineEdit`. If ``0``, there is no limit. .. _class_LineEdit_placeholder_alpha: - :ref:`float` **placeholder_alpha** - Opacity of the :ref:`placeholder_text`. From ``0`` to ``1``. .. _class_LineEdit_placeholder_text: - :ref:`String` **placeholder_text** - Text shown when the :ref:`LineEdit` is empty. It is **not** the :ref:`LineEdit`'s default value (see :ref:`text`). .. _class_LineEdit_secret: - :ref:`bool` **secret** - If ``true`` every character is shown as "\*". .. _class_LineEdit_text: - :ref:`String` **text** - String value of the :ref:`LineEdit`. Enums ----- .. _enum_LineEdit_Align: enum **Align** - **ALIGN_LEFT** = **0** --- Aligns the text on the left hand side of the :ref:`LineEdit`. - **ALIGN_CENTER** = **1** --- Centers the text in the middle of the :ref:`LineEdit`. - **ALIGN_RIGHT** = **2** --- Aligns the text on the right hand side of the :ref:`LineEdit`. - **ALIGN_FILL** = **3** --- Stretches whitespaces to fit the :ref:`LineEdit`'s width. .. _enum_LineEdit_MenuItems: enum **MenuItems** - **MENU_CUT** = **0** --- Cuts (Copies and clears) the selected text. - **MENU_COPY** = **1** --- Copies the selected text. - **MENU_PASTE** = **2** --- Pastes the clipboard text over the selected text (or at the cursor's position). - **MENU_CLEAR** = **3** --- Erases the whole Linedit text. - **MENU_SELECT_ALL** = **4** --- Selects the whole Linedit text. - **MENU_UNDO** = **5** --- Undoes the previous action. - **MENU_REDO** = **6** - **MENU_MAX** = **7** 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 **)** Adds ``text`` after the cursor. If the resulting value is longer than :ref:`max_length`, nothing happens. .. _class_LineEdit_clear: - void **clear** **(** **)** Erases the :ref:`LineEdit` text. .. _class_LineEdit_deselect: - void **deselect** **(** **)** Clears the current selection. .. _class_LineEdit_get_menu: - :ref:`PopupMenu` **get_menu** **(** **)** const Returns the :ref:`PopupMenu` of this ``LineEdit``. By default, this menu is displayed when right-clicking on the :ref:`LineEdit`. .. _class_LineEdit_menu_option: - void **menu_option** **(** :ref:`int` option **)** Executes a given action as defined in the MENU\_\* enum. .. _class_LineEdit_select: - void **select** **(** :ref:`int` from=0, :ref:`int` to=-1 **)** Selects characters inside :ref:`LineEdit` between ``from`` and ``to``. By default ``from`` is at the beginning and ``to`` at the end. :: text = "Welcome" select() # Welcome select(4) # ome select(2, 5) # lco .. _class_LineEdit_select_all: - void **select_all** **(** **)** Selects the whole :ref:`String`.