class_lineedit.rst 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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:`set_align<class_LineEdit_set_align>` **(** :ref:`int<class_int>` align **)** |
  15. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`get_align<class_LineEdit_get_align>` **(** **)** const |
  17. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`clear<class_LineEdit_clear>` **(** **)** |
  19. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`select_all<class_LineEdit_select_all>` **(** **)** |
  21. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`set_text<class_LineEdit_set_text>` **(** :ref:`String<class_string>` text **)** |
  23. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  24. | :ref:`String<class_string>` | :ref:`get_text<class_LineEdit_get_text>` **(** **)** const |
  25. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`set_cursor_pos<class_LineEdit_set_cursor_pos>` **(** :ref:`int<class_int>` pos **)** |
  27. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`get_cursor_pos<class_LineEdit_get_cursor_pos>` **(** **)** const |
  29. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_max_length<class_LineEdit_set_max_length>` **(** :ref:`int<class_int>` chars **)** |
  31. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_max_length<class_LineEdit_get_max_length>` **(** **)** const |
  33. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`append_at_cursor<class_LineEdit_append_at_cursor>` **(** :ref:`String<class_string>` text **)** |
  35. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`set_editable<class_LineEdit_set_editable>` **(** :ref:`bool<class_bool>` enabled **)** |
  37. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`is_editable<class_LineEdit_is_editable>` **(** **)** const |
  39. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_secret<class_LineEdit_set_secret>` **(** :ref:`bool<class_bool>` enabled **)** |
  41. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_secret<class_LineEdit_is_secret>` **(** **)** const |
  43. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`select<class_LineEdit_select>` **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)** |
  45. +------------------------------+--------------------------------------------------------------------------------------------------------------+
  46. Signals
  47. -------
  48. - **text_entered** **(** :ref:`String<class_string>` text **)**
  49. - **text_changed** **(** :ref:`String<class_string>` text **)**
  50. Numeric Constants
  51. -----------------
  52. - **ALIGN_LEFT** = **0**
  53. - **ALIGN_CENTER** = **1**
  54. - **ALIGN_RIGHT** = **2**
  55. - **ALIGN_FILL** = **3**
  56. Description
  57. -----------
  58. LineEdit provides a single line string editor, used for text fields.
  59. Member Function Description
  60. ---------------------------
  61. .. _class_LineEdit_set_align:
  62. - void **set_align** **(** :ref:`int<class_int>` align **)**
  63. .. _class_LineEdit_get_align:
  64. - :ref:`int<class_int>` **get_align** **(** **)** const
  65. .. _class_LineEdit_clear:
  66. - void **clear** **(** **)**
  67. Clear the :ref:`LineEdit<class_lineedit>` text.
  68. .. _class_LineEdit_select_all:
  69. - void **select_all** **(** **)**
  70. Select the whole string.
  71. .. _class_LineEdit_set_text:
  72. - void **set_text** **(** :ref:`String<class_string>` text **)**
  73. Set the text in the :ref:`LineEdit<class_lineedit>`, clearing the existing one and the selection.
  74. .. _class_LineEdit_get_text:
  75. - :ref:`String<class_string>` **get_text** **(** **)** const
  76. Return the text in the :ref:`LineEdit<class_lineedit>`.
  77. .. _class_LineEdit_set_cursor_pos:
  78. - void **set_cursor_pos** **(** :ref:`int<class_int>` pos **)**
  79. Set the cursor position inside the :ref:`LineEdit<class_lineedit>`, causing it to scroll if needed.
  80. .. _class_LineEdit_get_cursor_pos:
  81. - :ref:`int<class_int>` **get_cursor_pos** **(** **)** const
  82. Return the cursor position inside the :ref:`LineEdit<class_lineedit>`.
  83. .. _class_LineEdit_set_max_length:
  84. - void **set_max_length** **(** :ref:`int<class_int>` chars **)**
  85. 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.
  86. .. _class_LineEdit_get_max_length:
  87. - :ref:`int<class_int>` **get_max_length** **(** **)** const
  88. Return the maximum amount of characters the :ref:`LineEdit<class_lineedit>` can edit. If 0 is returned, no limit exists.
  89. .. _class_LineEdit_append_at_cursor:
  90. - void **append_at_cursor** **(** :ref:`String<class_string>` text **)**
  91. Append text at cursor, scrolling the :ref:`LineEdit<class_lineedit>` when needed.
  92. .. _class_LineEdit_set_editable:
  93. - void **set_editable** **(** :ref:`bool<class_bool>` enabled **)**
  94. 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.
  95. .. _class_LineEdit_is_editable:
  96. - :ref:`bool<class_bool>` **is_editable** **(** **)** const
  97. Return the *editable* status of the :ref:`LineEdit<class_lineedit>` (see :ref:`set_editable<class_LineEdit_set_editable>`).
  98. .. _class_LineEdit_set_secret:
  99. - void **set_secret** **(** :ref:`bool<class_bool>` enabled **)**
  100. Set the *secret* status of the :ref:`LineEdit<class_lineedit>`. When enabled, every character is displayed as "\*".
  101. .. _class_LineEdit_is_secret:
  102. - :ref:`bool<class_bool>` **is_secret** **(** **)** const
  103. Return the *secret* status of the :ref:`LineEdit<class_lineedit>` (see :ref:`set_secret<class_LineEdit_set_secret>`).
  104. .. _class_LineEdit_select:
  105. - void **select** **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)**