123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- .. 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/<name>/doc_classes.
- .. _class_LineEdit:
- LineEdit
- ========
- **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
- **Category:** Core
- Brief Description
- -----------------
- Control that provides single line string editing.
- Member Functions
- ----------------
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | void | :ref:`append_at_cursor<class_LineEdit_append_at_cursor>` **(** :ref:`String<class_string>` text **)** |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear<class_LineEdit_clear>` **(** **)** |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | void | :ref:`deselect<class_LineEdit_deselect>` **(** **)** |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | :ref:`PopupMenu<class_popupmenu>` | :ref:`get_menu<class_LineEdit_get_menu>` **(** **)** const |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | void | :ref:`menu_option<class_LineEdit_menu_option>` **(** :ref:`int<class_int>` option **)** |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | void | :ref:`select<class_LineEdit_select>` **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)** |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- | void | :ref:`select_all<class_LineEdit_select_all>` **(** **)** |
- +------------------------------------+------------------------------------------------------------------------------------------------------------+
- Signals
- -------
- .. _class_LineEdit_text_changed:
- - **text_changed** **(** :ref:`String<class_string>` new_text **)**
- Emitted when the text changes.
- .. _class_LineEdit_text_entered:
- - **text_entered** **(** :ref:`String<class_string>` new_text **)**
- Emitted when the user presses KEY_ENTER on the ``LineEdit``.
- Member Variables
- ----------------
- .. _class_LineEdit_align:
- - :ref:`Align<enum_lineedit_align>` **align** - Text alignment as defined in the ALIGN\_\* enum.
- .. _class_LineEdit_caret_blink:
- - :ref:`bool<class_bool>` **caret_blink** - If ``true`` the caret (visual cursor) blinks.
- .. _class_LineEdit_caret_blink_speed:
- - :ref:`float<class_float>` **caret_blink_speed** - Duration (in seconds) of a caret's blinking cycle.
- .. _class_LineEdit_caret_position:
- - :ref:`int<class_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<class_bool>` **context_menu_enabled** - If ``true`` the context menu will appear when right clicked.
- .. _class_LineEdit_editable:
- - :ref:`bool<class_bool>` **editable** - If ``false`` existing text cannot be modified and new text cannot be added.
- .. _class_LineEdit_expand_to_text_length:
- - :ref:`bool<class_bool>` **expand_to_text_length** - If ``true`` the :ref:`LineEdit<class_lineedit>` width will increase to stay longer than the :ref:`text<class_LineEdit_text>`. It will **not** compress if the :ref:`text<class_LineEdit_text>` is shortened.
- .. _class_LineEdit_focus_mode:
- - :ref:`FocusMode<enum_control_focusmode>` **focus_mode** - Defines how the :ref:`LineEdit<class_lineedit>` can grab focus (Keyboard and mouse, only keyboard, or none). See ``enum FocusMode`` in :ref:`Control<class_control>` for details.
- .. _class_LineEdit_max_length:
- - :ref:`int<class_int>` **max_length** - Maximum amount of characters that can be entered inside the :ref:`LineEdit<class_lineedit>`. If ``0``, there is no limit.
- .. _class_LineEdit_placeholder_alpha:
- - :ref:`float<class_float>` **placeholder_alpha** - Opacity of the :ref:`placeholder_text<class_LineEdit_placeholder_text>`. From ``0`` to ``1``.
- .. _class_LineEdit_placeholder_text:
- - :ref:`String<class_string>` **placeholder_text** - Text shown when the :ref:`LineEdit<class_lineedit>` is empty. It is **not** the :ref:`LineEdit<class_lineedit>`'s default value (see :ref:`text<class_LineEdit_text>`).
- .. _class_LineEdit_secret:
- - :ref:`bool<class_bool>` **secret** - If ``true`` every character is shown as "\*".
- .. _class_LineEdit_text:
- - :ref:`String<class_string>` **text** - String value of the :ref:`LineEdit<class_lineedit>`.
- Enums
- -----
- .. _enum_LineEdit_Align:
- enum **Align**
- - **ALIGN_LEFT** = **0** --- Aligns the text on the left hand side of the :ref:`LineEdit<class_lineedit>`.
- - **ALIGN_CENTER** = **1** --- Centers the text in the middle of the :ref:`LineEdit<class_lineedit>`.
- - **ALIGN_RIGHT** = **2** --- Aligns the text on the right hand side of the :ref:`LineEdit<class_lineedit>`.
- - **ALIGN_FILL** = **3** --- Stretches whitespaces to fit the :ref:`LineEdit<class_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<class_string>` text **)**
- Adds ``text`` after the cursor. If the resulting value is longer than :ref:`max_length<class_LineEdit_max_length>`, nothing happens.
- .. _class_LineEdit_clear:
- - void **clear** **(** **)**
- Erases the :ref:`LineEdit<class_lineedit>` text.
- .. _class_LineEdit_deselect:
- - void **deselect** **(** **)**
- Clears the current selection.
- .. _class_LineEdit_get_menu:
- - :ref:`PopupMenu<class_popupmenu>` **get_menu** **(** **)** const
- Returns the :ref:`PopupMenu<class_popupmenu>` of this ``LineEdit``. By default, this menu is displayed when right-clicking on the :ref:`LineEdit<class_lineedit>`.
- .. _class_LineEdit_menu_option:
- - void **menu_option** **(** :ref:`int<class_int>` option **)**
- Executes a given action as defined in the MENU\_\* enum.
- .. _class_LineEdit_select:
- - void **select** **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)**
- Selects characters inside :ref:`LineEdit<class_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<class_string>`.
|