class_lineedit.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_LineEdit:
  4. LineEdit
  5. ========
  6. **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Control that provides single line string editing.
  11. Member Functions
  12. ----------------
  13. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`append_at_cursor<class_LineEdit_append_at_cursor>` **(** :ref:`String<class_string>` text **)** |
  15. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`clear<class_LineEdit_clear>` **(** **)** |
  17. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`cursor_get_blink_enabled<class_LineEdit_cursor_get_blink_enabled>` **(** **)** const |
  19. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`cursor_get_blink_speed<class_LineEdit_cursor_get_blink_speed>` **(** **)** const |
  21. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`cursor_set_blink_enabled<class_LineEdit_cursor_set_blink_enabled>` **(** :ref:`bool<class_bool>` enabled **)** |
  23. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`cursor_set_blink_speed<class_LineEdit_cursor_set_blink_speed>` **(** :ref:`float<class_float>` blink_speed **)** |
  25. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_align<class_LineEdit_get_align>` **(** **)** const |
  27. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`get_cursor_pos<class_LineEdit_get_cursor_pos>` **(** **)** const |
  29. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`get_expand_to_text_length<class_LineEdit_get_expand_to_text_length>` **(** **)** const |
  31. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_max_length<class_LineEdit_get_max_length>` **(** **)** const |
  33. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`PopupMenu<class_popupmenu>` | :ref:`get_menu<class_LineEdit_get_menu>` **(** **)** const |
  35. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`String<class_string>` | :ref:`get_placeholder<class_LineEdit_get_placeholder>` **(** **)** const |
  37. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`float<class_float>` | :ref:`get_placeholder_alpha<class_LineEdit_get_placeholder_alpha>` **(** **)** const |
  39. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`String<class_string>` | :ref:`get_text<class_LineEdit_get_text>` **(** **)** const |
  41. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_editable<class_LineEdit_is_editable>` **(** **)** const |
  43. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`bool<class_bool>` | :ref:`is_secret<class_LineEdit_is_secret>` **(** **)** const |
  45. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`menu_option<class_LineEdit_menu_option>` **(** :ref:`int<class_int>` option **)** |
  47. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`select<class_LineEdit_select>` **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)** |
  49. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`select_all<class_LineEdit_select_all>` **(** **)** |
  51. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_align<class_LineEdit_set_align>` **(** :ref:`int<class_int>` align **)** |
  53. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_cursor_pos<class_LineEdit_set_cursor_pos>` **(** :ref:`int<class_int>` pos **)** |
  55. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_editable<class_LineEdit_set_editable>` **(** :ref:`bool<class_bool>` enabled **)** |
  57. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_expand_to_text_length<class_LineEdit_set_expand_to_text_length>` **(** :ref:`bool<class_bool>` enabled **)** |
  59. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_max_length<class_LineEdit_set_max_length>` **(** :ref:`int<class_int>` chars **)** |
  61. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_placeholder<class_LineEdit_set_placeholder>` **(** :ref:`String<class_string>` text **)** |
  63. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_placeholder_alpha<class_LineEdit_set_placeholder_alpha>` **(** :ref:`float<class_float>` alpha **)** |
  65. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`set_secret<class_LineEdit_set_secret>` **(** :ref:`bool<class_bool>` enabled **)** |
  67. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  68. | void | :ref:`set_text<class_LineEdit_set_text>` **(** :ref:`String<class_string>` text **)** |
  69. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  70. Signals
  71. -------
  72. - **text_changed** **(** :ref:`String<class_string>` text **)**
  73. When the text changes, this signal is emitted.
  74. - **text_entered** **(** :ref:`String<class_string>` text **)**
  75. This signal is emitted when the user presses KEY_ENTER on the :ref:`LineEdit<class_lineedit>`. This signal is often used as an alternate confirmation mechanism in dialogs.
  76. Member Variables
  77. ----------------
  78. - :ref:`int<class_int>` **align**
  79. - :ref:`bool<class_bool>` **caret_blink**
  80. - :ref:`float<class_float>` **caret_blink_speed**
  81. - :ref:`bool<class_bool>` **editable**
  82. - :ref:`bool<class_bool>` **expand_to_len**
  83. - :ref:`int<class_int>` **focus_mode**
  84. - :ref:`int<class_int>` **max_length**
  85. - :ref:`float<class_float>` **placeholder_alpha**
  86. - :ref:`String<class_string>` **placeholder_text**
  87. - :ref:`bool<class_bool>` **secret**
  88. - :ref:`String<class_string>` **text**
  89. Numeric Constants
  90. -----------------
  91. - **ALIGN_LEFT** = **0**
  92. - **ALIGN_CENTER** = **1**
  93. - **ALIGN_RIGHT** = **2**
  94. - **ALIGN_FILL** = **3**
  95. - **MENU_CUT** = **0**
  96. - **MENU_COPY** = **1**
  97. - **MENU_PASTE** = **2**
  98. - **MENU_CLEAR** = **3**
  99. - **MENU_SELECT_ALL** = **4**
  100. - **MENU_UNDO** = **5**
  101. - **MENU_MAX** = **6**
  102. Description
  103. -----------
  104. LineEdit provides a single line string editor, used for text fields.
  105. Member Function Description
  106. ---------------------------
  107. .. _class_LineEdit_append_at_cursor:
  108. - void **append_at_cursor** **(** :ref:`String<class_string>` text **)**
  109. Append text at cursor, scrolling the :ref:`LineEdit<class_lineedit>` when needed.
  110. .. _class_LineEdit_clear:
  111. - void **clear** **(** **)**
  112. Clear the :ref:`LineEdit<class_lineedit>` text.
  113. .. _class_LineEdit_cursor_get_blink_enabled:
  114. - :ref:`bool<class_bool>` **cursor_get_blink_enabled** **(** **)** const
  115. Gets whether the line edit caret is blinking.
  116. .. _class_LineEdit_cursor_get_blink_speed:
  117. - :ref:`float<class_float>` **cursor_get_blink_speed** **(** **)** const
  118. Gets the line edit caret blink speed.
  119. .. _class_LineEdit_cursor_set_blink_enabled:
  120. - void **cursor_set_blink_enabled** **(** :ref:`bool<class_bool>` enabled **)**
  121. Set the line edit caret to blink.
  122. .. _class_LineEdit_cursor_set_blink_speed:
  123. - void **cursor_set_blink_speed** **(** :ref:`float<class_float>` blink_speed **)**
  124. Set the line edit caret blink speed. Cannot be less then or equal to 0.
  125. .. _class_LineEdit_get_align:
  126. - :ref:`int<class_int>` **get_align** **(** **)** const
  127. .. _class_LineEdit_get_cursor_pos:
  128. - :ref:`int<class_int>` **get_cursor_pos** **(** **)** const
  129. Return the cursor position inside the :ref:`LineEdit<class_lineedit>`.
  130. .. _class_LineEdit_get_expand_to_text_length:
  131. - :ref:`bool<class_bool>` **get_expand_to_text_length** **(** **)** const
  132. .. _class_LineEdit_get_max_length:
  133. - :ref:`int<class_int>` **get_max_length** **(** **)** const
  134. Return the maximum amount of characters the :ref:`LineEdit<class_lineedit>` can edit. If 0 is returned, no limit exists.
  135. .. _class_LineEdit_get_menu:
  136. - :ref:`PopupMenu<class_popupmenu>` **get_menu** **(** **)** const
  137. .. _class_LineEdit_get_placeholder:
  138. - :ref:`String<class_string>` **get_placeholder** **(** **)** const
  139. .. _class_LineEdit_get_placeholder_alpha:
  140. - :ref:`float<class_float>` **get_placeholder_alpha** **(** **)** const
  141. .. _class_LineEdit_get_text:
  142. - :ref:`String<class_string>` **get_text** **(** **)** const
  143. Return the text in the :ref:`LineEdit<class_lineedit>`.
  144. .. _class_LineEdit_is_editable:
  145. - :ref:`bool<class_bool>` **is_editable** **(** **)** const
  146. Return the *editable* status of the :ref:`LineEdit<class_lineedit>` (see :ref:`set_editable<class_LineEdit_set_editable>`).
  147. .. _class_LineEdit_is_secret:
  148. - :ref:`bool<class_bool>` **is_secret** **(** **)** const
  149. Return the *secret* status of the :ref:`LineEdit<class_lineedit>` (see :ref:`set_secret<class_LineEdit_set_secret>`).
  150. .. _class_LineEdit_menu_option:
  151. - void **menu_option** **(** :ref:`int<class_int>` option **)**
  152. .. _class_LineEdit_select:
  153. - void **select** **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)**
  154. .. _class_LineEdit_select_all:
  155. - void **select_all** **(** **)**
  156. Select the whole string.
  157. .. _class_LineEdit_set_align:
  158. - void **set_align** **(** :ref:`int<class_int>` align **)**
  159. .. _class_LineEdit_set_cursor_pos:
  160. - void **set_cursor_pos** **(** :ref:`int<class_int>` pos **)**
  161. Set the cursor position inside the :ref:`LineEdit<class_lineedit>`, causing it to scroll if needed.
  162. .. _class_LineEdit_set_editable:
  163. - void **set_editable** **(** :ref:`bool<class_bool>` enabled **)**
  164. Set the *editable* status of the :ref:`LineEdit<class_lineedit>`. When disabled, existing text can't be modified and new text can't be added.
  165. .. _class_LineEdit_set_expand_to_text_length:
  166. - void **set_expand_to_text_length** **(** :ref:`bool<class_bool>` enabled **)**
  167. .. _class_LineEdit_set_max_length:
  168. - void **set_max_length** **(** :ref:`int<class_int>` chars **)**
  169. Set the maximum amount of characters the :ref:`LineEdit<class_lineedit>` can edit, and cropping existing text in case it exceeds that limit. Setting 0 removes the limit.
  170. .. _class_LineEdit_set_placeholder:
  171. - void **set_placeholder** **(** :ref:`String<class_string>` text **)**
  172. .. _class_LineEdit_set_placeholder_alpha:
  173. - void **set_placeholder_alpha** **(** :ref:`float<class_float>` alpha **)**
  174. .. _class_LineEdit_set_secret:
  175. - void **set_secret** **(** :ref:`bool<class_bool>` enabled **)**
  176. Set the *secret* status of the :ref:`LineEdit<class_lineedit>`. When enabled, every character is displayed as "\*".
  177. .. _class_LineEdit_set_text:
  178. - void **set_text** **(** :ref:`String<class_string>` text **)**
  179. Set the text in the :ref:`LineEdit<class_lineedit>`, clearing the existing one and the selection.