class_lineedit.rst 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the LineEdit.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_LineEdit:
  6. LineEdit
  7. ========
  8. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Control that provides single-line string editing.
  10. Description
  11. -----------
  12. LineEdit provides a single-line string editor, used for text fields.
  13. It features many built-in shortcuts which will always be available (``Ctrl`` here maps to ``Command`` on macOS):
  14. - Ctrl + C: Copy
  15. - Ctrl + X: Cut
  16. - Ctrl + V or Ctrl + Y: Paste/"yank"
  17. - Ctrl + Z: Undo
  18. - Ctrl + Shift + Z: Redo
  19. - Ctrl + U: Delete text from the cursor position to the beginning of the line
  20. - Ctrl + K: Delete text from the cursor position to the end of the line
  21. - Ctrl + A: Select all text
  22. - Up/Down arrow: Move the cursor to the beginning/end of the line
  23. On macOS, some extra keyboard shortcuts are available:
  24. - Ctrl + F: Like the right arrow key, move the cursor one character right
  25. - Ctrl + B: Like the left arrow key, move the cursor one character left
  26. - Ctrl + P: Like the up arrow key, move the cursor to the previous line
  27. - Ctrl + N: Like the down arrow key, move the cursor to the next line
  28. - Ctrl + D: Like the Delete key, delete the character on the right side of cursor
  29. - Ctrl + H: Like the Backspace key, delete the character on the left side of the cursor
  30. - Command + Left arrow: Like the Home key, move the cursor to the beginning of the line
  31. - Command + Right arrow: Like the End key, move the cursor to the end of the line
  32. Properties
  33. ----------
  34. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  35. | :ref:`Align<enum_LineEdit_Align>` | :ref:`align<class_LineEdit_property_align>` | ``0`` |
  36. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`caret_blink<class_LineEdit_property_caret_blink>` | ``false`` |
  38. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  39. | :ref:`float<class_float>` | :ref:`caret_blink_speed<class_LineEdit_property_caret_blink_speed>` | ``0.65`` |
  40. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  41. | :ref:`int<class_int>` | :ref:`caret_position<class_LineEdit_property_caret_position>` | ``0`` |
  42. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`clear_button_enabled<class_LineEdit_property_clear_button_enabled>` | ``false`` |
  44. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`context_menu_enabled<class_LineEdit_property_context_menu_enabled>` | ``true`` |
  46. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`editable<class_LineEdit_property_editable>` | ``true`` |
  48. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  49. | :ref:`bool<class_bool>` | :ref:`expand_to_text_length<class_LineEdit_property_expand_to_text_length>` | ``false`` |
  50. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  51. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` *(parent override)* |
  52. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  53. | :ref:`int<class_int>` | :ref:`max_length<class_LineEdit_property_max_length>` | ``0`` |
  54. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  55. | :ref:`CursorShape<enum_Control_CursorShape>` | mouse_default_cursor_shape | ``1`` *(parent override)* |
  56. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  57. | :ref:`float<class_float>` | :ref:`placeholder_alpha<class_LineEdit_property_placeholder_alpha>` | ``0.6`` |
  58. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  59. | :ref:`String<class_String>` | :ref:`placeholder_text<class_LineEdit_property_placeholder_text>` | ``""`` |
  60. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  61. | :ref:`Texture<class_Texture>` | :ref:`right_icon<class_LineEdit_property_right_icon>` | |
  62. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`secret<class_LineEdit_property_secret>` | ``false`` |
  64. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  65. | :ref:`String<class_String>` | :ref:`secret_character<class_LineEdit_property_secret_character>` | ``"*"`` |
  66. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`selecting_enabled<class_LineEdit_property_selecting_enabled>` | ``true`` |
  68. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  69. | :ref:`bool<class_bool>` | :ref:`shortcut_keys_enabled<class_LineEdit_property_shortcut_keys_enabled>` | ``true`` |
  70. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  71. | :ref:`String<class_String>` | :ref:`text<class_LineEdit_property_text>` | ``""`` |
  72. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  73. | :ref:`bool<class_bool>` | :ref:`virtual_keyboard_enabled<class_LineEdit_property_virtual_keyboard_enabled>` | ``true`` |
  74. +----------------------------------------------+-----------------------------------------------------------------------------------+---------------------------+
  75. Methods
  76. -------
  77. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`append_at_cursor<class_LineEdit_method_append_at_cursor>` **(** :ref:`String<class_String>` text **)** |
  79. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`clear<class_LineEdit_method_clear>` **(** **)** |
  81. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`delete_char_at_cursor<class_LineEdit_method_delete_char_at_cursor>` **(** **)** |
  83. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`delete_text<class_LineEdit_method_delete_text>` **(** :ref:`int<class_int>` from_column, :ref:`int<class_int>` to_column **)** |
  85. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`deselect<class_LineEdit_method_deselect>` **(** **)** |
  87. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_menu<class_LineEdit_method_get_menu>` **(** **)** |const| |
  89. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`menu_option<class_LineEdit_method_menu_option>` **(** :ref:`int<class_int>` option **)** |
  91. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`select<class_LineEdit_method_select>` **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)** |
  93. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`select_all<class_LineEdit_method_select_all>` **(** **)** |
  95. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  96. Theme Properties
  97. ----------------
  98. +---------------------------------+----------------------------+--------------------------------+
  99. | :ref:`Texture<class_Texture>` | clear | |
  100. +---------------------------------+----------------------------+--------------------------------+
  101. | :ref:`Color<class_Color>` | clear_button_color | Color( 0.88, 0.88, 0.88, 1 ) |
  102. +---------------------------------+----------------------------+--------------------------------+
  103. | :ref:`Color<class_Color>` | clear_button_color_pressed | Color( 1, 1, 1, 1 ) |
  104. +---------------------------------+----------------------------+--------------------------------+
  105. | :ref:`Color<class_Color>` | cursor_color | Color( 0.94, 0.94, 0.94, 1 ) |
  106. +---------------------------------+----------------------------+--------------------------------+
  107. | :ref:`StyleBox<class_StyleBox>` | focus | |
  108. +---------------------------------+----------------------------+--------------------------------+
  109. | :ref:`Font<class_Font>` | font | |
  110. +---------------------------------+----------------------------+--------------------------------+
  111. | :ref:`Color<class_Color>` | font_color | Color( 0.88, 0.88, 0.88, 1 ) |
  112. +---------------------------------+----------------------------+--------------------------------+
  113. | :ref:`Color<class_Color>` | font_color_selected | Color( 0, 0, 0, 1 ) |
  114. +---------------------------------+----------------------------+--------------------------------+
  115. | :ref:`Color<class_Color>` | font_color_uneditable | Color( 0.88, 0.88, 0.88, 0.5 ) |
  116. +---------------------------------+----------------------------+--------------------------------+
  117. | :ref:`int<class_int>` | minimum_spaces | 12 |
  118. +---------------------------------+----------------------------+--------------------------------+
  119. | :ref:`StyleBox<class_StyleBox>` | normal | |
  120. +---------------------------------+----------------------------+--------------------------------+
  121. | :ref:`StyleBox<class_StyleBox>` | read_only | |
  122. +---------------------------------+----------------------------+--------------------------------+
  123. | :ref:`Color<class_Color>` | selection_color | Color( 0.49, 0.49, 0.49, 1 ) |
  124. +---------------------------------+----------------------------+--------------------------------+
  125. Signals
  126. -------
  127. .. _class_LineEdit_signal_text_change_rejected:
  128. - **text_change_rejected** **(** **)**
  129. Emitted when trying to append text that would overflow the :ref:`max_length<class_LineEdit_property_max_length>`.
  130. ----
  131. .. _class_LineEdit_signal_text_changed:
  132. - **text_changed** **(** :ref:`String<class_String>` new_text **)**
  133. Emitted when the text changes.
  134. ----
  135. .. _class_LineEdit_signal_text_entered:
  136. - **text_entered** **(** :ref:`String<class_String>` new_text **)**
  137. Emitted when the user presses :ref:`@GlobalScope.KEY_ENTER<class_@GlobalScope_constant_KEY_ENTER>` on the ``LineEdit``.
  138. Enumerations
  139. ------------
  140. .. _enum_LineEdit_Align:
  141. .. _class_LineEdit_constant_ALIGN_LEFT:
  142. .. _class_LineEdit_constant_ALIGN_CENTER:
  143. .. _class_LineEdit_constant_ALIGN_RIGHT:
  144. .. _class_LineEdit_constant_ALIGN_FILL:
  145. enum **Align**:
  146. - **ALIGN_LEFT** = **0** --- Aligns the text on the left-hand side of the ``LineEdit``.
  147. - **ALIGN_CENTER** = **1** --- Centers the text in the middle of the ``LineEdit``.
  148. - **ALIGN_RIGHT** = **2** --- Aligns the text on the right-hand side of the ``LineEdit``.
  149. - **ALIGN_FILL** = **3** --- Stretches whitespaces to fit the ``LineEdit``'s width.
  150. ----
  151. .. _enum_LineEdit_MenuItems:
  152. .. _class_LineEdit_constant_MENU_CUT:
  153. .. _class_LineEdit_constant_MENU_COPY:
  154. .. _class_LineEdit_constant_MENU_PASTE:
  155. .. _class_LineEdit_constant_MENU_CLEAR:
  156. .. _class_LineEdit_constant_MENU_SELECT_ALL:
  157. .. _class_LineEdit_constant_MENU_UNDO:
  158. .. _class_LineEdit_constant_MENU_REDO:
  159. .. _class_LineEdit_constant_MENU_MAX:
  160. enum **MenuItems**:
  161. - **MENU_CUT** = **0** --- Cuts (copies and clears) the selected text.
  162. - **MENU_COPY** = **1** --- Copies the selected text.
  163. - **MENU_PASTE** = **2** --- Pastes the clipboard text over the selected text (or at the cursor's position).
  164. Non-printable escape characters are automatically stripped from the OS clipboard via :ref:`String.strip_escapes<class_String_method_strip_escapes>`.
  165. - **MENU_CLEAR** = **3** --- Erases the whole ``LineEdit`` text.
  166. - **MENU_SELECT_ALL** = **4** --- Selects the whole ``LineEdit`` text.
  167. - **MENU_UNDO** = **5** --- Undoes the previous action.
  168. - **MENU_REDO** = **6** --- Reverse the last undo action.
  169. - **MENU_MAX** = **7** --- Represents the size of the :ref:`MenuItems<enum_LineEdit_MenuItems>` enum.
  170. Property Descriptions
  171. ---------------------
  172. .. _class_LineEdit_property_align:
  173. - :ref:`Align<enum_LineEdit_Align>` **align**
  174. +-----------+------------------+
  175. | *Default* | ``0`` |
  176. +-----------+------------------+
  177. | *Setter* | set_align(value) |
  178. +-----------+------------------+
  179. | *Getter* | get_align() |
  180. +-----------+------------------+
  181. Text alignment as defined in the :ref:`Align<enum_LineEdit_Align>` enum.
  182. ----
  183. .. _class_LineEdit_property_caret_blink:
  184. - :ref:`bool<class_bool>` **caret_blink**
  185. +-----------+---------------------------------+
  186. | *Default* | ``false`` |
  187. +-----------+---------------------------------+
  188. | *Setter* | cursor_set_blink_enabled(value) |
  189. +-----------+---------------------------------+
  190. | *Getter* | cursor_get_blink_enabled() |
  191. +-----------+---------------------------------+
  192. If ``true``, the caret (visual cursor) blinks.
  193. ----
  194. .. _class_LineEdit_property_caret_blink_speed:
  195. - :ref:`float<class_float>` **caret_blink_speed**
  196. +-----------+-------------------------------+
  197. | *Default* | ``0.65`` |
  198. +-----------+-------------------------------+
  199. | *Setter* | cursor_set_blink_speed(value) |
  200. +-----------+-------------------------------+
  201. | *Getter* | cursor_get_blink_speed() |
  202. +-----------+-------------------------------+
  203. Duration (in seconds) of a caret's blinking cycle.
  204. ----
  205. .. _class_LineEdit_property_caret_position:
  206. - :ref:`int<class_int>` **caret_position**
  207. +-----------+----------------------------+
  208. | *Default* | ``0`` |
  209. +-----------+----------------------------+
  210. | *Setter* | set_cursor_position(value) |
  211. +-----------+----------------------------+
  212. | *Getter* | get_cursor_position() |
  213. +-----------+----------------------------+
  214. The cursor's position inside the ``LineEdit``. When set, the text may scroll to accommodate it.
  215. ----
  216. .. _class_LineEdit_property_clear_button_enabled:
  217. - :ref:`bool<class_bool>` **clear_button_enabled**
  218. +-----------+---------------------------------+
  219. | *Default* | ``false`` |
  220. +-----------+---------------------------------+
  221. | *Setter* | set_clear_button_enabled(value) |
  222. +-----------+---------------------------------+
  223. | *Getter* | is_clear_button_enabled() |
  224. +-----------+---------------------------------+
  225. If ``true``, the ``LineEdit`` will show a clear button if ``text`` is not empty, which can be used to clear the text quickly.
  226. ----
  227. .. _class_LineEdit_property_context_menu_enabled:
  228. - :ref:`bool<class_bool>` **context_menu_enabled**
  229. +-----------+---------------------------------+
  230. | *Default* | ``true`` |
  231. +-----------+---------------------------------+
  232. | *Setter* | set_context_menu_enabled(value) |
  233. +-----------+---------------------------------+
  234. | *Getter* | is_context_menu_enabled() |
  235. +-----------+---------------------------------+
  236. If ``true``, the context menu will appear when right-clicked.
  237. ----
  238. .. _class_LineEdit_property_editable:
  239. - :ref:`bool<class_bool>` **editable**
  240. +-----------+---------------------+
  241. | *Default* | ``true`` |
  242. +-----------+---------------------+
  243. | *Setter* | set_editable(value) |
  244. +-----------+---------------------+
  245. | *Getter* | is_editable() |
  246. +-----------+---------------------+
  247. If ``false``, existing text cannot be modified and new text cannot be added.
  248. ----
  249. .. _class_LineEdit_property_expand_to_text_length:
  250. - :ref:`bool<class_bool>` **expand_to_text_length**
  251. +-----------+----------------------------------+
  252. | *Default* | ``false`` |
  253. +-----------+----------------------------------+
  254. | *Setter* | set_expand_to_text_length(value) |
  255. +-----------+----------------------------------+
  256. | *Getter* | get_expand_to_text_length() |
  257. +-----------+----------------------------------+
  258. If ``true``, the ``LineEdit`` width will increase to stay longer than the :ref:`text<class_LineEdit_property_text>`. It will **not** compress if the :ref:`text<class_LineEdit_property_text>` is shortened.
  259. ----
  260. .. _class_LineEdit_property_max_length:
  261. - :ref:`int<class_int>` **max_length**
  262. +-----------+-----------------------+
  263. | *Default* | ``0`` |
  264. +-----------+-----------------------+
  265. | *Setter* | set_max_length(value) |
  266. +-----------+-----------------------+
  267. | *Getter* | get_max_length() |
  268. +-----------+-----------------------+
  269. Maximum amount of characters that can be entered inside the ``LineEdit``. If ``0``, there is no limit.
  270. ----
  271. .. _class_LineEdit_property_placeholder_alpha:
  272. - :ref:`float<class_float>` **placeholder_alpha**
  273. +-----------+------------------------------+
  274. | *Default* | ``0.6`` |
  275. +-----------+------------------------------+
  276. | *Setter* | set_placeholder_alpha(value) |
  277. +-----------+------------------------------+
  278. | *Getter* | get_placeholder_alpha() |
  279. +-----------+------------------------------+
  280. Opacity of the :ref:`placeholder_text<class_LineEdit_property_placeholder_text>`. From ``0`` to ``1``.
  281. ----
  282. .. _class_LineEdit_property_placeholder_text:
  283. - :ref:`String<class_String>` **placeholder_text**
  284. +-----------+------------------------+
  285. | *Default* | ``""`` |
  286. +-----------+------------------------+
  287. | *Setter* | set_placeholder(value) |
  288. +-----------+------------------------+
  289. | *Getter* | get_placeholder() |
  290. +-----------+------------------------+
  291. Text shown when the ``LineEdit`` is empty. It is **not** the ``LineEdit``'s default value (see :ref:`text<class_LineEdit_property_text>`).
  292. ----
  293. .. _class_LineEdit_property_right_icon:
  294. - :ref:`Texture<class_Texture>` **right_icon**
  295. +----------+-----------------------+
  296. | *Setter* | set_right_icon(value) |
  297. +----------+-----------------------+
  298. | *Getter* | get_right_icon() |
  299. +----------+-----------------------+
  300. Sets the icon that will appear in the right end of the ``LineEdit`` if there's no :ref:`text<class_LineEdit_property_text>`, or always, if :ref:`clear_button_enabled<class_LineEdit_property_clear_button_enabled>` is set to ``false``.
  301. ----
  302. .. _class_LineEdit_property_secret:
  303. - :ref:`bool<class_bool>` **secret**
  304. +-----------+-------------------+
  305. | *Default* | ``false`` |
  306. +-----------+-------------------+
  307. | *Setter* | set_secret(value) |
  308. +-----------+-------------------+
  309. | *Getter* | is_secret() |
  310. +-----------+-------------------+
  311. If ``true``, every character is replaced with the secret character (see :ref:`secret_character<class_LineEdit_property_secret_character>`).
  312. ----
  313. .. _class_LineEdit_property_secret_character:
  314. - :ref:`String<class_String>` **secret_character**
  315. +-----------+-----------------------------+
  316. | *Default* | ``"*"`` |
  317. +-----------+-----------------------------+
  318. | *Setter* | set_secret_character(value) |
  319. +-----------+-----------------------------+
  320. | *Getter* | get_secret_character() |
  321. +-----------+-----------------------------+
  322. The character to use to mask secret input (defaults to "\*"). Only a single character can be used as the secret character.
  323. ----
  324. .. _class_LineEdit_property_selecting_enabled:
  325. - :ref:`bool<class_bool>` **selecting_enabled**
  326. +-----------+------------------------------+
  327. | *Default* | ``true`` |
  328. +-----------+------------------------------+
  329. | *Setter* | set_selecting_enabled(value) |
  330. +-----------+------------------------------+
  331. | *Getter* | is_selecting_enabled() |
  332. +-----------+------------------------------+
  333. If ``false``, it's impossible to select the text using mouse nor keyboard.
  334. ----
  335. .. _class_LineEdit_property_shortcut_keys_enabled:
  336. - :ref:`bool<class_bool>` **shortcut_keys_enabled**
  337. +-----------+----------------------------------+
  338. | *Default* | ``true`` |
  339. +-----------+----------------------------------+
  340. | *Setter* | set_shortcut_keys_enabled(value) |
  341. +-----------+----------------------------------+
  342. | *Getter* | is_shortcut_keys_enabled() |
  343. +-----------+----------------------------------+
  344. If ``false``, using shortcuts will be disabled.
  345. ----
  346. .. _class_LineEdit_property_text:
  347. - :ref:`String<class_String>` **text**
  348. +-----------+-----------------+
  349. | *Default* | ``""`` |
  350. +-----------+-----------------+
  351. | *Setter* | set_text(value) |
  352. +-----------+-----------------+
  353. | *Getter* | get_text() |
  354. +-----------+-----------------+
  355. String value of the ``LineEdit``.
  356. **Note:** Changing text using this property won't emit the :ref:`text_changed<class_LineEdit_signal_text_changed>` signal.
  357. ----
  358. .. _class_LineEdit_property_virtual_keyboard_enabled:
  359. - :ref:`bool<class_bool>` **virtual_keyboard_enabled**
  360. +-----------+-------------------------------------+
  361. | *Default* | ``true`` |
  362. +-----------+-------------------------------------+
  363. | *Setter* | set_virtual_keyboard_enabled(value) |
  364. +-----------+-------------------------------------+
  365. | *Getter* | is_virtual_keyboard_enabled() |
  366. +-----------+-------------------------------------+
  367. If ``true``, the native virtual keyboard is shown when focused on platforms that support it.
  368. Method Descriptions
  369. -------------------
  370. .. _class_LineEdit_method_append_at_cursor:
  371. - void **append_at_cursor** **(** :ref:`String<class_String>` text **)**
  372. Adds ``text`` after the cursor. If the resulting value is longer than :ref:`max_length<class_LineEdit_property_max_length>`, nothing happens.
  373. ----
  374. .. _class_LineEdit_method_clear:
  375. - void **clear** **(** **)**
  376. Erases the ``LineEdit``'s :ref:`text<class_LineEdit_property_text>`.
  377. ----
  378. .. _class_LineEdit_method_delete_char_at_cursor:
  379. - void **delete_char_at_cursor** **(** **)**
  380. Deletes one character at the cursor's current position (equivalent to pressing the ``Delete`` key).
  381. ----
  382. .. _class_LineEdit_method_delete_text:
  383. - void **delete_text** **(** :ref:`int<class_int>` from_column, :ref:`int<class_int>` to_column **)**
  384. Deletes a section of the :ref:`text<class_LineEdit_property_text>` going from position ``from_column`` to ``to_column``. Both parameters should be within the text's length.
  385. ----
  386. .. _class_LineEdit_method_deselect:
  387. - void **deselect** **(** **)**
  388. Clears the current selection.
  389. ----
  390. .. _class_LineEdit_method_get_menu:
  391. - :ref:`PopupMenu<class_PopupMenu>` **get_menu** **(** **)** |const|
  392. Returns the :ref:`PopupMenu<class_PopupMenu>` of this ``LineEdit``. By default, this menu is displayed when right-clicking on the ``LineEdit``.
  393. ----
  394. .. _class_LineEdit_method_menu_option:
  395. - void **menu_option** **(** :ref:`int<class_int>` option **)**
  396. Executes a given action as defined in the :ref:`MenuItems<enum_LineEdit_MenuItems>` enum.
  397. ----
  398. .. _class_LineEdit_method_select:
  399. - void **select** **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)**
  400. Selects characters inside ``LineEdit`` between ``from`` and ``to``. By default, ``from`` is at the beginning and ``to`` at the end.
  401. ::
  402. text = "Welcome"
  403. select() # Will select "Welcome".
  404. select(4) # Will select "ome".
  405. select(2, 5) # Will select "lco".
  406. ----
  407. .. _class_LineEdit_method_select_all:
  408. - void **select_all** **(** **)**
  409. Selects the whole :ref:`String<class_String>`.
  410. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  411. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  412. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`