class_lineedit.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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>` enable **)** |
  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:`int<class_int>` | :ref:`get_max_length<class_LineEdit_get_max_length>` **(** **)** const |
  31. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`PopupMenu<class_popupmenu>` | :ref:`get_menu<class_LineEdit_get_menu>` **(** **)** const |
  33. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`String<class_string>` | :ref:`get_placeholder<class_LineEdit_get_placeholder>` **(** **)** const |
  35. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`float<class_float>` | :ref:`get_placeholder_alpha<class_LineEdit_get_placeholder_alpha>` **(** **)** const |
  37. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_string>` | :ref:`get_text<class_LineEdit_get_text>` **(** **)** const |
  39. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`is_editable<class_LineEdit_is_editable>` **(** **)** const |
  41. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_secret<class_LineEdit_is_secret>` **(** **)** const |
  43. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`menu_option<class_LineEdit_menu_option>` **(** :ref:`int<class_int>` option **)** |
  45. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`select<class_LineEdit_select>` **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)** |
  47. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`select_all<class_LineEdit_select_all>` **(** **)** |
  49. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_align<class_LineEdit_set_align>` **(** :ref:`int<class_int>` align **)** |
  51. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_cursor_pos<class_LineEdit_set_cursor_pos>` **(** :ref:`int<class_int>` pos **)** |
  53. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_editable<class_LineEdit_set_editable>` **(** :ref:`bool<class_bool>` enabled **)** |
  55. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_max_length<class_LineEdit_set_max_length>` **(** :ref:`int<class_int>` chars **)** |
  57. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_placeholder<class_LineEdit_set_placeholder>` **(** :ref:`String<class_string>` text **)** |
  59. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_placeholder_alpha<class_LineEdit_set_placeholder_alpha>` **(** :ref:`float<class_float>` alpha **)** |
  61. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_secret<class_LineEdit_set_secret>` **(** :ref:`bool<class_bool>` enabled **)** |
  63. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_text<class_LineEdit_set_text>` **(** :ref:`String<class_string>` text **)** |
  65. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  66. Signals
  67. -------
  68. - **text_changed** **(** :ref:`String<class_string>` text **)**
  69. When the text changes, this signal is emitted.
  70. - **text_entered** **(** :ref:`String<class_string>` text **)**
  71. 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.
  72. Numeric Constants
  73. -----------------
  74. - **ALIGN_LEFT** = **0**
  75. - **ALIGN_CENTER** = **1**
  76. - **ALIGN_RIGHT** = **2**
  77. - **ALIGN_FILL** = **3**
  78. - **MENU_CUT** = **0**
  79. - **MENU_COPY** = **1**
  80. - **MENU_PASTE** = **2**
  81. - **MENU_CLEAR** = **3**
  82. - **MENU_SELECT_ALL** = **4**
  83. - **MENU_UNDO** = **5**
  84. - **MENU_MAX** = **6**
  85. Description
  86. -----------
  87. LineEdit provides a single line string editor, used for text fields.
  88. Member Function Description
  89. ---------------------------
  90. .. _class_LineEdit_append_at_cursor:
  91. - void **append_at_cursor** **(** :ref:`String<class_string>` text **)**
  92. Append text at cursor, scrolling the :ref:`LineEdit<class_lineedit>` when needed.
  93. .. _class_LineEdit_clear:
  94. - void **clear** **(** **)**
  95. Clear the :ref:`LineEdit<class_lineedit>` text.
  96. .. _class_LineEdit_cursor_get_blink_enabled:
  97. - :ref:`bool<class_bool>` **cursor_get_blink_enabled** **(** **)** const
  98. Gets whether the line edit caret is blinking.
  99. .. _class_LineEdit_cursor_get_blink_speed:
  100. - :ref:`float<class_float>` **cursor_get_blink_speed** **(** **)** const
  101. Gets the line edit caret blink speed.
  102. .. _class_LineEdit_cursor_set_blink_enabled:
  103. - void **cursor_set_blink_enabled** **(** :ref:`bool<class_bool>` enable **)**
  104. Set the line edit caret to blink.
  105. .. _class_LineEdit_cursor_set_blink_speed:
  106. - void **cursor_set_blink_speed** **(** :ref:`float<class_float>` blink_speed **)**
  107. Set the line edit caret blink speed. Cannot be less then or equal to 0.
  108. .. _class_LineEdit_get_align:
  109. - :ref:`int<class_int>` **get_align** **(** **)** const
  110. .. _class_LineEdit_get_cursor_pos:
  111. - :ref:`int<class_int>` **get_cursor_pos** **(** **)** const
  112. Return the cursor position inside the :ref:`LineEdit<class_lineedit>`.
  113. .. _class_LineEdit_get_max_length:
  114. - :ref:`int<class_int>` **get_max_length** **(** **)** const
  115. Return the maximum amount of characters the :ref:`LineEdit<class_lineedit>` can edit. If 0 is returned, no limit exists.
  116. .. _class_LineEdit_get_menu:
  117. - :ref:`PopupMenu<class_popupmenu>` **get_menu** **(** **)** const
  118. .. _class_LineEdit_get_placeholder:
  119. - :ref:`String<class_string>` **get_placeholder** **(** **)** const
  120. .. _class_LineEdit_get_placeholder_alpha:
  121. - :ref:`float<class_float>` **get_placeholder_alpha** **(** **)** const
  122. .. _class_LineEdit_get_text:
  123. - :ref:`String<class_string>` **get_text** **(** **)** const
  124. Return the text in the :ref:`LineEdit<class_lineedit>`.
  125. .. _class_LineEdit_is_editable:
  126. - :ref:`bool<class_bool>` **is_editable** **(** **)** const
  127. Return the *editable* status of the :ref:`LineEdit<class_lineedit>` (see :ref:`set_editable<class_LineEdit_set_editable>`).
  128. .. _class_LineEdit_is_secret:
  129. - :ref:`bool<class_bool>` **is_secret** **(** **)** const
  130. Return the *secret* status of the :ref:`LineEdit<class_lineedit>` (see :ref:`set_secret<class_LineEdit_set_secret>`).
  131. .. _class_LineEdit_menu_option:
  132. - void **menu_option** **(** :ref:`int<class_int>` option **)**
  133. .. _class_LineEdit_select:
  134. - void **select** **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)**
  135. .. _class_LineEdit_select_all:
  136. - void **select_all** **(** **)**
  137. Select the whole string.
  138. .. _class_LineEdit_set_align:
  139. - void **set_align** **(** :ref:`int<class_int>` align **)**
  140. .. _class_LineEdit_set_cursor_pos:
  141. - void **set_cursor_pos** **(** :ref:`int<class_int>` pos **)**
  142. Set the cursor position inside the :ref:`LineEdit<class_lineedit>`, causing it to scroll if needed.
  143. .. _class_LineEdit_set_editable:
  144. - void **set_editable** **(** :ref:`bool<class_bool>` enabled **)**
  145. 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.
  146. .. _class_LineEdit_set_max_length:
  147. - void **set_max_length** **(** :ref:`int<class_int>` chars **)**
  148. 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.
  149. .. _class_LineEdit_set_placeholder:
  150. - void **set_placeholder** **(** :ref:`String<class_string>` text **)**
  151. .. _class_LineEdit_set_placeholder_alpha:
  152. - void **set_placeholder_alpha** **(** :ref:`float<class_float>` alpha **)**
  153. .. _class_LineEdit_set_secret:
  154. - void **set_secret** **(** :ref:`bool<class_bool>` enabled **)**
  155. Set the *secret* status of the :ref:`LineEdit<class_lineedit>`. When enabled, every character is displayed as "\*".
  156. .. _class_LineEdit_set_text:
  157. - void **set_text** **(** :ref:`String<class_string>` text **)**
  158. Set the text in the :ref:`LineEdit<class_lineedit>`, clearing the existing one and the selection.