class_lineedit.rst 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/LineEdit.xml.
  6. .. _class_LineEdit:
  7. LineEdit
  8. ========
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Control that provides single-line string editing.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. LineEdit provides a single-line string editor, used for text fields.
  15. It features many built-in shortcuts which will always be available (:kbd:`Ctrl` here maps to :kbd:`Cmd` on macOS):
  16. - :kbd:`Ctrl + C`: Copy
  17. - :kbd:`Ctrl + X`: Cut
  18. - :kbd:`Ctrl + V` or :kbd:`Ctrl + Y`: Paste/"yank"
  19. - :kbd:`Ctrl + Z`: Undo
  20. - :kbd:`Ctrl + ~`: Swap input direction.
  21. - :kbd:`Ctrl + Shift + Z`: Redo
  22. - :kbd:`Ctrl + U`: Delete text from the caret position to the beginning of the line
  23. - :kbd:`Ctrl + K`: Delete text from the caret position to the end of the line
  24. - :kbd:`Ctrl + A`: Select all text
  25. - :kbd:`Up Arrow`/:kbd:`Down Arrow`: Move the caret to the beginning/end of the line
  26. On macOS, some extra keyboard shortcuts are available:
  27. - :kbd:`Ctrl + F`: Same as :kbd:`Right Arrow`, move the caret one character right
  28. - :kbd:`Ctrl + B`: Same as :kbd:`Left Arrow`, move the caret one character left
  29. - :kbd:`Ctrl + P`: Same as :kbd:`Up Arrow`, move the caret to the previous line
  30. - :kbd:`Ctrl + N`: Same as :kbd:`Down Arrow`, move the caret to the next line
  31. - :kbd:`Ctrl + D`: Same as :kbd:`Delete`, delete the character on the right side of caret
  32. - :kbd:`Ctrl + H`: Same as :kbd:`Backspace`, delete the character on the left side of the caret
  33. - :kbd:`Ctrl + A`: Same as :kbd:`Home`, move the caret to the beginning of the line
  34. - :kbd:`Ctrl + E`: Same as :kbd:`End`, move the caret to the end of the line
  35. - :kbd:`Cmd + Left Arrow`: Same as :kbd:`Home`, move the caret to the beginning of the line
  36. - :kbd:`Cmd + Right Arrow`: Same as :kbd:`End`, move the caret to the end of the line
  37. .. rst-class:: classref-reftable-group
  38. Properties
  39. ----------
  40. .. table::
  41. :widths: auto
  42. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  43. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`alignment<class_LineEdit_property_alignment>` | ``0`` |
  44. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`caret_blink<class_LineEdit_property_caret_blink>` | ``false`` |
  46. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  47. | :ref:`float<class_float>` | :ref:`caret_blink_interval<class_LineEdit_property_caret_blink_interval>` | ``0.65`` |
  48. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`caret_column<class_LineEdit_property_caret_column>` | ``0`` |
  50. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`caret_force_displayed<class_LineEdit_property_caret_force_displayed>` | ``false`` |
  52. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`caret_mid_grapheme<class_LineEdit_property_caret_mid_grapheme>` | ``true`` |
  54. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  55. | :ref:`bool<class_bool>` | :ref:`clear_button_enabled<class_LineEdit_property_clear_button_enabled>` | ``false`` |
  56. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`context_menu_enabled<class_LineEdit_property_context_menu_enabled>` | ``true`` |
  58. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`deselect_on_focus_loss_enabled<class_LineEdit_property_deselect_on_focus_loss_enabled>` | ``true`` |
  60. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`draw_control_chars<class_LineEdit_property_draw_control_chars>` | ``false`` |
  62. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`editable<class_LineEdit_property_editable>` | ``true`` |
  64. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`expand_to_text_length<class_LineEdit_property_expand_to_text_length>` | ``false`` |
  66. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`flat<class_LineEdit_property_flat>` | ``false`` |
  68. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  69. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  70. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  71. | :ref:`String<class_String>` | :ref:`language<class_LineEdit_property_language>` | ``""`` |
  72. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  73. | :ref:`int<class_int>` | :ref:`max_length<class_LineEdit_property_max_length>` | ``0`` |
  74. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  75. | :ref:`bool<class_bool>` | :ref:`middle_mouse_paste_enabled<class_LineEdit_property_middle_mouse_paste_enabled>` | ``true`` |
  76. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  77. | :ref:`CursorShape<enum_Control_CursorShape>` | mouse_default_cursor_shape | ``1`` (overrides :ref:`Control<class_Control_property_mouse_default_cursor_shape>`) |
  78. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  79. | :ref:`String<class_String>` | :ref:`placeholder_text<class_LineEdit_property_placeholder_text>` | ``""`` |
  80. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  81. | :ref:`Texture2D<class_Texture2D>` | :ref:`right_icon<class_LineEdit_property_right_icon>` | |
  82. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  83. | :ref:`bool<class_bool>` | :ref:`secret<class_LineEdit_property_secret>` | ``false`` |
  84. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  85. | :ref:`String<class_String>` | :ref:`secret_character<class_LineEdit_property_secret_character>` | ``"•"`` |
  86. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  87. | :ref:`bool<class_bool>` | :ref:`select_all_on_focus<class_LineEdit_property_select_all_on_focus>` | ``false`` |
  88. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  89. | :ref:`bool<class_bool>` | :ref:`selecting_enabled<class_LineEdit_property_selecting_enabled>` | ``true`` |
  90. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  91. | :ref:`bool<class_bool>` | :ref:`shortcut_keys_enabled<class_LineEdit_property_shortcut_keys_enabled>` | ``true`` |
  92. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  93. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_LineEdit_property_structured_text_bidi_override>` | ``0`` |
  94. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  95. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_LineEdit_property_structured_text_bidi_override_options>` | ``[]`` |
  96. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  97. | :ref:`String<class_String>` | :ref:`text<class_LineEdit_property_text>` | ``""`` |
  98. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  99. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`text_direction<class_LineEdit_property_text_direction>` | ``0`` |
  100. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  101. | :ref:`bool<class_bool>` | :ref:`virtual_keyboard_enabled<class_LineEdit_property_virtual_keyboard_enabled>` | ``true`` |
  102. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  103. | :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` | :ref:`virtual_keyboard_type<class_LineEdit_property_virtual_keyboard_type>` | ``0`` |
  104. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+
  105. .. rst-class:: classref-reftable-group
  106. Methods
  107. -------
  108. .. table::
  109. :widths: auto
  110. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  111. | void | :ref:`clear<class_LineEdit_method_clear>` **(** **)** |
  112. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`delete_char_at_caret<class_LineEdit_method_delete_char_at_caret>` **(** **)** |
  114. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  115. | void | :ref:`delete_text<class_LineEdit_method_delete_text>` **(** :ref:`int<class_int>` from_column, :ref:`int<class_int>` to_column **)** |
  116. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  117. | void | :ref:`deselect<class_LineEdit_method_deselect>` **(** **)** |
  118. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_menu<class_LineEdit_method_get_menu>` **(** **)** |const| |
  120. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`float<class_float>` | :ref:`get_scroll_offset<class_LineEdit_method_get_scroll_offset>` **(** **)** |const| |
  122. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`int<class_int>` | :ref:`get_selection_from_column<class_LineEdit_method_get_selection_from_column>` **(** **)** |const| |
  124. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`int<class_int>` | :ref:`get_selection_to_column<class_LineEdit_method_get_selection_to_column>` **(** **)** |const| |
  126. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`bool<class_bool>` | :ref:`has_selection<class_LineEdit_method_has_selection>` **(** **)** |const| |
  128. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  129. | void | :ref:`insert_text_at_caret<class_LineEdit_method_insert_text_at_caret>` **(** :ref:`String<class_String>` text **)** |
  130. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`bool<class_bool>` | :ref:`is_menu_visible<class_LineEdit_method_is_menu_visible>` **(** **)** |const| |
  132. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  133. | void | :ref:`menu_option<class_LineEdit_method_menu_option>` **(** :ref:`int<class_int>` option **)** |
  134. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  135. | void | :ref:`select<class_LineEdit_method_select>` **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)** |
  136. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  137. | void | :ref:`select_all<class_LineEdit_method_select_all>` **(** **)** |
  138. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  139. .. rst-class:: classref-reftable-group
  140. Theme Properties
  141. ----------------
  142. .. table::
  143. :widths: auto
  144. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  145. | :ref:`Color<class_Color>` | :ref:`caret_color<class_LineEdit_theme_color_caret_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  146. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  147. | :ref:`Color<class_Color>` | :ref:`clear_button_color<class_LineEdit_theme_color_clear_button_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  148. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  149. | :ref:`Color<class_Color>` | :ref:`clear_button_color_pressed<class_LineEdit_theme_color_clear_button_color_pressed>` | ``Color(1, 1, 1, 1)`` |
  150. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  151. | :ref:`Color<class_Color>` | :ref:`font_color<class_LineEdit_theme_color_font_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  152. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  153. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_LineEdit_theme_color_font_outline_color>` | ``Color(1, 1, 1, 1)`` |
  154. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  155. | :ref:`Color<class_Color>` | :ref:`font_placeholder_color<class_LineEdit_theme_color_font_placeholder_color>` | ``Color(0.875, 0.875, 0.875, 0.6)`` |
  156. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  157. | :ref:`Color<class_Color>` | :ref:`font_selected_color<class_LineEdit_theme_color_font_selected_color>` | ``Color(1, 1, 1, 1)`` |
  158. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  159. | :ref:`Color<class_Color>` | :ref:`font_uneditable_color<class_LineEdit_theme_color_font_uneditable_color>` | ``Color(0.875, 0.875, 0.875, 0.5)`` |
  160. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  161. | :ref:`Color<class_Color>` | :ref:`selection_color<class_LineEdit_theme_color_selection_color>` | ``Color(0.5, 0.5, 0.5, 1)`` |
  162. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  163. | :ref:`int<class_int>` | :ref:`caret_width<class_LineEdit_theme_constant_caret_width>` | ``1`` |
  164. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  165. | :ref:`int<class_int>` | :ref:`minimum_character_width<class_LineEdit_theme_constant_minimum_character_width>` | ``4`` |
  166. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  167. | :ref:`int<class_int>` | :ref:`outline_size<class_LineEdit_theme_constant_outline_size>` | ``0`` |
  168. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  169. | :ref:`Font<class_Font>` | :ref:`font<class_LineEdit_theme_font_font>` | |
  170. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  171. | :ref:`int<class_int>` | :ref:`font_size<class_LineEdit_theme_font_size_font_size>` | |
  172. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  173. | :ref:`Texture2D<class_Texture2D>` | :ref:`clear<class_LineEdit_theme_icon_clear>` | |
  174. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  175. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_LineEdit_theme_style_focus>` | |
  176. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  177. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_LineEdit_theme_style_normal>` | |
  178. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  179. | :ref:`StyleBox<class_StyleBox>` | :ref:`read_only<class_LineEdit_theme_style_read_only>` | |
  180. +-----------------------------------+------------------------------------------------------------------------------------------+-------------------------------------+
  181. .. rst-class:: classref-section-separator
  182. ----
  183. .. rst-class:: classref-descriptions-group
  184. Signals
  185. -------
  186. .. _class_LineEdit_signal_text_change_rejected:
  187. .. rst-class:: classref-signal
  188. **text_change_rejected** **(** :ref:`String<class_String>` rejected_substring **)**
  189. Emitted when appending text that overflows the :ref:`max_length<class_LineEdit_property_max_length>`. The appended text is truncated to fit :ref:`max_length<class_LineEdit_property_max_length>`, and the part that couldn't fit is passed as the ``rejected_substring`` argument.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_LineEdit_signal_text_changed:
  193. .. rst-class:: classref-signal
  194. **text_changed** **(** :ref:`String<class_String>` new_text **)**
  195. Emitted when the text changes.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_LineEdit_signal_text_submitted:
  199. .. rst-class:: classref-signal
  200. **text_submitted** **(** :ref:`String<class_String>` new_text **)**
  201. Emitted when the user presses :ref:`@GlobalScope.KEY_ENTER<class_@GlobalScope_constant_KEY_ENTER>` on the **LineEdit**.
  202. .. rst-class:: classref-section-separator
  203. ----
  204. .. rst-class:: classref-descriptions-group
  205. Enumerations
  206. ------------
  207. .. _enum_LineEdit_MenuItems:
  208. .. rst-class:: classref-enumeration
  209. enum **MenuItems**:
  210. .. _class_LineEdit_constant_MENU_CUT:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_CUT** = ``0``
  213. Cuts (copies and clears) the selected text.
  214. .. _class_LineEdit_constant_MENU_COPY:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_COPY** = ``1``
  217. Copies the selected text.
  218. .. _class_LineEdit_constant_MENU_PASTE:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_PASTE** = ``2``
  221. Pastes the clipboard text over the selected text (or at the caret's position).
  222. Non-printable escape characters are automatically stripped from the OS clipboard via :ref:`String.strip_escapes<class_String_method_strip_escapes>`.
  223. .. _class_LineEdit_constant_MENU_CLEAR:
  224. .. rst-class:: classref-enumeration-constant
  225. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_CLEAR** = ``3``
  226. Erases the whole **LineEdit** text.
  227. .. _class_LineEdit_constant_MENU_SELECT_ALL:
  228. .. rst-class:: classref-enumeration-constant
  229. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_SELECT_ALL** = ``4``
  230. Selects the whole **LineEdit** text.
  231. .. _class_LineEdit_constant_MENU_UNDO:
  232. .. rst-class:: classref-enumeration-constant
  233. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_UNDO** = ``5``
  234. Undoes the previous action.
  235. .. _class_LineEdit_constant_MENU_REDO:
  236. .. rst-class:: classref-enumeration-constant
  237. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_REDO** = ``6``
  238. Reverse the last undo action.
  239. .. _class_LineEdit_constant_MENU_SUBMENU_TEXT_DIR:
  240. .. rst-class:: classref-enumeration-constant
  241. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_SUBMENU_TEXT_DIR** = ``7``
  242. ID of "Text Writing Direction" submenu.
  243. .. _class_LineEdit_constant_MENU_DIR_INHERITED:
  244. .. rst-class:: classref-enumeration-constant
  245. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_DIR_INHERITED** = ``8``
  246. Sets text direction to inherited.
  247. .. _class_LineEdit_constant_MENU_DIR_AUTO:
  248. .. rst-class:: classref-enumeration-constant
  249. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_DIR_AUTO** = ``9``
  250. Sets text direction to automatic.
  251. .. _class_LineEdit_constant_MENU_DIR_LTR:
  252. .. rst-class:: classref-enumeration-constant
  253. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_DIR_LTR** = ``10``
  254. Sets text direction to left-to-right.
  255. .. _class_LineEdit_constant_MENU_DIR_RTL:
  256. .. rst-class:: classref-enumeration-constant
  257. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_DIR_RTL** = ``11``
  258. Sets text direction to right-to-left.
  259. .. _class_LineEdit_constant_MENU_DISPLAY_UCC:
  260. .. rst-class:: classref-enumeration-constant
  261. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_DISPLAY_UCC** = ``12``
  262. Toggles control character display.
  263. .. _class_LineEdit_constant_MENU_SUBMENU_INSERT_UCC:
  264. .. rst-class:: classref-enumeration-constant
  265. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_SUBMENU_INSERT_UCC** = ``13``
  266. ID of "Insert Control Character" submenu.
  267. .. _class_LineEdit_constant_MENU_INSERT_LRM:
  268. .. rst-class:: classref-enumeration-constant
  269. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_LRM** = ``14``
  270. Inserts left-to-right mark (LRM) character.
  271. .. _class_LineEdit_constant_MENU_INSERT_RLM:
  272. .. rst-class:: classref-enumeration-constant
  273. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_RLM** = ``15``
  274. Inserts right-to-left mark (RLM) character.
  275. .. _class_LineEdit_constant_MENU_INSERT_LRE:
  276. .. rst-class:: classref-enumeration-constant
  277. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_LRE** = ``16``
  278. Inserts start of left-to-right embedding (LRE) character.
  279. .. _class_LineEdit_constant_MENU_INSERT_RLE:
  280. .. rst-class:: classref-enumeration-constant
  281. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_RLE** = ``17``
  282. Inserts start of right-to-left embedding (RLE) character.
  283. .. _class_LineEdit_constant_MENU_INSERT_LRO:
  284. .. rst-class:: classref-enumeration-constant
  285. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_LRO** = ``18``
  286. Inserts start of left-to-right override (LRO) character.
  287. .. _class_LineEdit_constant_MENU_INSERT_RLO:
  288. .. rst-class:: classref-enumeration-constant
  289. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_RLO** = ``19``
  290. Inserts start of right-to-left override (RLO) character.
  291. .. _class_LineEdit_constant_MENU_INSERT_PDF:
  292. .. rst-class:: classref-enumeration-constant
  293. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_PDF** = ``20``
  294. Inserts pop direction formatting (PDF) character.
  295. .. _class_LineEdit_constant_MENU_INSERT_ALM:
  296. .. rst-class:: classref-enumeration-constant
  297. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_ALM** = ``21``
  298. Inserts Arabic letter mark (ALM) character.
  299. .. _class_LineEdit_constant_MENU_INSERT_LRI:
  300. .. rst-class:: classref-enumeration-constant
  301. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_LRI** = ``22``
  302. Inserts left-to-right isolate (LRI) character.
  303. .. _class_LineEdit_constant_MENU_INSERT_RLI:
  304. .. rst-class:: classref-enumeration-constant
  305. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_RLI** = ``23``
  306. Inserts right-to-left isolate (RLI) character.
  307. .. _class_LineEdit_constant_MENU_INSERT_FSI:
  308. .. rst-class:: classref-enumeration-constant
  309. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_FSI** = ``24``
  310. Inserts first strong isolate (FSI) character.
  311. .. _class_LineEdit_constant_MENU_INSERT_PDI:
  312. .. rst-class:: classref-enumeration-constant
  313. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_PDI** = ``25``
  314. Inserts pop direction isolate (PDI) character.
  315. .. _class_LineEdit_constant_MENU_INSERT_ZWJ:
  316. .. rst-class:: classref-enumeration-constant
  317. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_ZWJ** = ``26``
  318. Inserts zero width joiner (ZWJ) character.
  319. .. _class_LineEdit_constant_MENU_INSERT_ZWNJ:
  320. .. rst-class:: classref-enumeration-constant
  321. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_ZWNJ** = ``27``
  322. Inserts zero width non-joiner (ZWNJ) character.
  323. .. _class_LineEdit_constant_MENU_INSERT_WJ:
  324. .. rst-class:: classref-enumeration-constant
  325. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_WJ** = ``28``
  326. Inserts word joiner (WJ) character.
  327. .. _class_LineEdit_constant_MENU_INSERT_SHY:
  328. .. rst-class:: classref-enumeration-constant
  329. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_INSERT_SHY** = ``29``
  330. Inserts soft hyphen (SHY) character.
  331. .. _class_LineEdit_constant_MENU_MAX:
  332. .. rst-class:: classref-enumeration-constant
  333. :ref:`MenuItems<enum_LineEdit_MenuItems>` **MENU_MAX** = ``30``
  334. Represents the size of the :ref:`MenuItems<enum_LineEdit_MenuItems>` enum.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _enum_LineEdit_VirtualKeyboardType:
  338. .. rst-class:: classref-enumeration
  339. enum **VirtualKeyboardType**:
  340. .. _class_LineEdit_constant_KEYBOARD_TYPE_DEFAULT:
  341. .. rst-class:: classref-enumeration-constant
  342. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_DEFAULT** = ``0``
  343. Default text virtual keyboard.
  344. .. _class_LineEdit_constant_KEYBOARD_TYPE_MULTILINE:
  345. .. rst-class:: classref-enumeration-constant
  346. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_MULTILINE** = ``1``
  347. Multiline virtual keyboard.
  348. .. _class_LineEdit_constant_KEYBOARD_TYPE_NUMBER:
  349. .. rst-class:: classref-enumeration-constant
  350. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_NUMBER** = ``2``
  351. Virtual number keypad, useful for PIN entry.
  352. .. _class_LineEdit_constant_KEYBOARD_TYPE_NUMBER_DECIMAL:
  353. .. rst-class:: classref-enumeration-constant
  354. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_NUMBER_DECIMAL** = ``3``
  355. Virtual number keypad, useful for entering fractional numbers.
  356. .. _class_LineEdit_constant_KEYBOARD_TYPE_PHONE:
  357. .. rst-class:: classref-enumeration-constant
  358. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_PHONE** = ``4``
  359. Virtual phone number keypad.
  360. .. _class_LineEdit_constant_KEYBOARD_TYPE_EMAIL_ADDRESS:
  361. .. rst-class:: classref-enumeration-constant
  362. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_EMAIL_ADDRESS** = ``5``
  363. Virtual keyboard with additional keys to assist with typing email addresses.
  364. .. _class_LineEdit_constant_KEYBOARD_TYPE_PASSWORD:
  365. .. rst-class:: classref-enumeration-constant
  366. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_PASSWORD** = ``6``
  367. Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization.
  368. \ **Note:** This is not supported on Web. Instead, this behaves identically to :ref:`KEYBOARD_TYPE_DEFAULT<class_LineEdit_constant_KEYBOARD_TYPE_DEFAULT>`.
  369. .. _class_LineEdit_constant_KEYBOARD_TYPE_URL:
  370. .. rst-class:: classref-enumeration-constant
  371. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **KEYBOARD_TYPE_URL** = ``7``
  372. Virtual keyboard with additional keys to assist with typing URLs.
  373. .. rst-class:: classref-section-separator
  374. ----
  375. .. rst-class:: classref-descriptions-group
  376. Property Descriptions
  377. ---------------------
  378. .. _class_LineEdit_property_alignment:
  379. .. rst-class:: classref-property
  380. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **alignment** = ``0``
  381. .. rst-class:: classref-property-setget
  382. - void **set_horizontal_alignment** **(** :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` value **)**
  383. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment** **(** **)**
  384. Text alignment as defined in the :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` enum.
  385. .. rst-class:: classref-item-separator
  386. ----
  387. .. _class_LineEdit_property_caret_blink:
  388. .. rst-class:: classref-property
  389. :ref:`bool<class_bool>` **caret_blink** = ``false``
  390. .. rst-class:: classref-property-setget
  391. - void **set_caret_blink_enabled** **(** :ref:`bool<class_bool>` value **)**
  392. - :ref:`bool<class_bool>` **is_caret_blink_enabled** **(** **)**
  393. If ``true``, the caret (text cursor) blinks.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_LineEdit_property_caret_blink_interval:
  397. .. rst-class:: classref-property
  398. :ref:`float<class_float>` **caret_blink_interval** = ``0.65``
  399. .. rst-class:: classref-property-setget
  400. - void **set_caret_blink_interval** **(** :ref:`float<class_float>` value **)**
  401. - :ref:`float<class_float>` **get_caret_blink_interval** **(** **)**
  402. Duration (in seconds) of a caret's blinking cycle.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_LineEdit_property_caret_column:
  406. .. rst-class:: classref-property
  407. :ref:`int<class_int>` **caret_column** = ``0``
  408. .. rst-class:: classref-property-setget
  409. - void **set_caret_column** **(** :ref:`int<class_int>` value **)**
  410. - :ref:`int<class_int>` **get_caret_column** **(** **)**
  411. The caret's column position inside the **LineEdit**. When set, the text may scroll to accommodate it.
  412. .. rst-class:: classref-item-separator
  413. ----
  414. .. _class_LineEdit_property_caret_force_displayed:
  415. .. rst-class:: classref-property
  416. :ref:`bool<class_bool>` **caret_force_displayed** = ``false``
  417. .. rst-class:: classref-property-setget
  418. - void **set_caret_force_displayed** **(** :ref:`bool<class_bool>` value **)**
  419. - :ref:`bool<class_bool>` **is_caret_force_displayed** **(** **)**
  420. If ``true``, the **LineEdit** will always show the caret, even if focus is lost.
  421. .. rst-class:: classref-item-separator
  422. ----
  423. .. _class_LineEdit_property_caret_mid_grapheme:
  424. .. rst-class:: classref-property
  425. :ref:`bool<class_bool>` **caret_mid_grapheme** = ``true``
  426. .. rst-class:: classref-property-setget
  427. - void **set_caret_mid_grapheme_enabled** **(** :ref:`bool<class_bool>` value **)**
  428. - :ref:`bool<class_bool>` **is_caret_mid_grapheme_enabled** **(** **)**
  429. Allow moving caret, selecting and removing the individual composite character components.
  430. \ **Note:** :kbd:`Backspace` is always removing individual composite character components.
  431. .. rst-class:: classref-item-separator
  432. ----
  433. .. _class_LineEdit_property_clear_button_enabled:
  434. .. rst-class:: classref-property
  435. :ref:`bool<class_bool>` **clear_button_enabled** = ``false``
  436. .. rst-class:: classref-property-setget
  437. - void **set_clear_button_enabled** **(** :ref:`bool<class_bool>` value **)**
  438. - :ref:`bool<class_bool>` **is_clear_button_enabled** **(** **)**
  439. If ``true``, the **LineEdit** will show a clear button if ``text`` is not empty, which can be used to clear the text quickly.
  440. .. rst-class:: classref-item-separator
  441. ----
  442. .. _class_LineEdit_property_context_menu_enabled:
  443. .. rst-class:: classref-property
  444. :ref:`bool<class_bool>` **context_menu_enabled** = ``true``
  445. .. rst-class:: classref-property-setget
  446. - void **set_context_menu_enabled** **(** :ref:`bool<class_bool>` value **)**
  447. - :ref:`bool<class_bool>` **is_context_menu_enabled** **(** **)**
  448. If ``true``, the context menu will appear when right-clicked.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _class_LineEdit_property_deselect_on_focus_loss_enabled:
  452. .. rst-class:: classref-property
  453. :ref:`bool<class_bool>` **deselect_on_focus_loss_enabled** = ``true``
  454. .. rst-class:: classref-property-setget
  455. - void **set_deselect_on_focus_loss_enabled** **(** :ref:`bool<class_bool>` value **)**
  456. - :ref:`bool<class_bool>` **is_deselect_on_focus_loss_enabled** **(** **)**
  457. If ``true``, the selected text will be deselected when focus is lost.
  458. .. rst-class:: classref-item-separator
  459. ----
  460. .. _class_LineEdit_property_draw_control_chars:
  461. .. rst-class:: classref-property
  462. :ref:`bool<class_bool>` **draw_control_chars** = ``false``
  463. .. rst-class:: classref-property-setget
  464. - void **set_draw_control_chars** **(** :ref:`bool<class_bool>` value **)**
  465. - :ref:`bool<class_bool>` **get_draw_control_chars** **(** **)**
  466. If ``true``, control characters are displayed.
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_LineEdit_property_editable:
  470. .. rst-class:: classref-property
  471. :ref:`bool<class_bool>` **editable** = ``true``
  472. .. rst-class:: classref-property-setget
  473. - void **set_editable** **(** :ref:`bool<class_bool>` value **)**
  474. - :ref:`bool<class_bool>` **is_editable** **(** **)**
  475. If ``false``, existing text cannot be modified and new text cannot be added.
  476. .. rst-class:: classref-item-separator
  477. ----
  478. .. _class_LineEdit_property_expand_to_text_length:
  479. .. rst-class:: classref-property
  480. :ref:`bool<class_bool>` **expand_to_text_length** = ``false``
  481. .. rst-class:: classref-property-setget
  482. - void **set_expand_to_text_length_enabled** **(** :ref:`bool<class_bool>` value **)**
  483. - :ref:`bool<class_bool>` **is_expand_to_text_length_enabled** **(** **)**
  484. 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.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_LineEdit_property_flat:
  488. .. rst-class:: classref-property
  489. :ref:`bool<class_bool>` **flat** = ``false``
  490. .. rst-class:: classref-property-setget
  491. - void **set_flat** **(** :ref:`bool<class_bool>` value **)**
  492. - :ref:`bool<class_bool>` **is_flat** **(** **)**
  493. If ``true``, the **LineEdit** don't display decoration.
  494. .. rst-class:: classref-item-separator
  495. ----
  496. .. _class_LineEdit_property_language:
  497. .. rst-class:: classref-property
  498. :ref:`String<class_String>` **language** = ``""``
  499. .. rst-class:: classref-property-setget
  500. - void **set_language** **(** :ref:`String<class_String>` value **)**
  501. - :ref:`String<class_String>` **get_language** **(** **)**
  502. Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  503. .. rst-class:: classref-item-separator
  504. ----
  505. .. _class_LineEdit_property_max_length:
  506. .. rst-class:: classref-property
  507. :ref:`int<class_int>` **max_length** = ``0``
  508. .. rst-class:: classref-property-setget
  509. - void **set_max_length** **(** :ref:`int<class_int>` value **)**
  510. - :ref:`int<class_int>` **get_max_length** **(** **)**
  511. Maximum number of characters that can be entered inside the **LineEdit**. If ``0``, there is no limit.
  512. When a limit is defined, characters that would exceed :ref:`max_length<class_LineEdit_property_max_length>` are truncated. This happens both for existing :ref:`text<class_LineEdit_property_text>` contents when setting the max length, or for new text inserted in the **LineEdit**, including pasting. If any input text is truncated, the :ref:`text_change_rejected<class_LineEdit_signal_text_change_rejected>` signal is emitted with the truncated substring as parameter.
  513. \ **Example:**\
  514. .. tabs::
  515. .. code-tab:: gdscript
  516. text = "Hello world"
  517. max_length = 5
  518. # `text` becomes "Hello".
  519. max_length = 10
  520. text += " goodbye"
  521. # `text` becomes "Hello good".
  522. # `text_change_rejected` is emitted with "bye" as parameter.
  523. .. code-tab:: csharp
  524. Text = "Hello world";
  525. MaxLength = 5;
  526. // `Text` becomes "Hello".
  527. MaxLength = 10;
  528. Text += " goodbye";
  529. // `Text` becomes "Hello good".
  530. // `text_change_rejected` is emitted with "bye" as parameter.
  531. .. rst-class:: classref-item-separator
  532. ----
  533. .. _class_LineEdit_property_middle_mouse_paste_enabled:
  534. .. rst-class:: classref-property
  535. :ref:`bool<class_bool>` **middle_mouse_paste_enabled** = ``true``
  536. .. rst-class:: classref-property-setget
  537. - void **set_middle_mouse_paste_enabled** **(** :ref:`bool<class_bool>` value **)**
  538. - :ref:`bool<class_bool>` **is_middle_mouse_paste_enabled** **(** **)**
  539. If ``false``, using middle mouse button to paste clipboard will be disabled.
  540. \ **Note:** This method is only implemented on Linux.
  541. .. rst-class:: classref-item-separator
  542. ----
  543. .. _class_LineEdit_property_placeholder_text:
  544. .. rst-class:: classref-property
  545. :ref:`String<class_String>` **placeholder_text** = ``""``
  546. .. rst-class:: classref-property-setget
  547. - void **set_placeholder** **(** :ref:`String<class_String>` value **)**
  548. - :ref:`String<class_String>` **get_placeholder** **(** **)**
  549. Text shown when the **LineEdit** is empty. It is **not** the **LineEdit**'s default value (see :ref:`text<class_LineEdit_property_text>`).
  550. .. rst-class:: classref-item-separator
  551. ----
  552. .. _class_LineEdit_property_right_icon:
  553. .. rst-class:: classref-property
  554. :ref:`Texture2D<class_Texture2D>` **right_icon**
  555. .. rst-class:: classref-property-setget
  556. - void **set_right_icon** **(** :ref:`Texture2D<class_Texture2D>` value **)**
  557. - :ref:`Texture2D<class_Texture2D>` **get_right_icon** **(** **)**
  558. 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``.
  559. .. rst-class:: classref-item-separator
  560. ----
  561. .. _class_LineEdit_property_secret:
  562. .. rst-class:: classref-property
  563. :ref:`bool<class_bool>` **secret** = ``false``
  564. .. rst-class:: classref-property-setget
  565. - void **set_secret** **(** :ref:`bool<class_bool>` value **)**
  566. - :ref:`bool<class_bool>` **is_secret** **(** **)**
  567. If ``true``, every character is replaced with the secret character (see :ref:`secret_character<class_LineEdit_property_secret_character>`).
  568. .. rst-class:: classref-item-separator
  569. ----
  570. .. _class_LineEdit_property_secret_character:
  571. .. rst-class:: classref-property
  572. :ref:`String<class_String>` **secret_character** = ``"•"``
  573. .. rst-class:: classref-property-setget
  574. - void **set_secret_character** **(** :ref:`String<class_String>` value **)**
  575. - :ref:`String<class_String>` **get_secret_character** **(** **)**
  576. The character to use to mask secret input (defaults to "•"). Only a single character can be used as the secret character.
  577. .. rst-class:: classref-item-separator
  578. ----
  579. .. _class_LineEdit_property_select_all_on_focus:
  580. .. rst-class:: classref-property
  581. :ref:`bool<class_bool>` **select_all_on_focus** = ``false``
  582. .. rst-class:: classref-property-setget
  583. - void **set_select_all_on_focus** **(** :ref:`bool<class_bool>` value **)**
  584. - :ref:`bool<class_bool>` **is_select_all_on_focus** **(** **)**
  585. If ``true``, the **LineEdit** will select the whole text when it gains focus.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _class_LineEdit_property_selecting_enabled:
  589. .. rst-class:: classref-property
  590. :ref:`bool<class_bool>` **selecting_enabled** = ``true``
  591. .. rst-class:: classref-property-setget
  592. - void **set_selecting_enabled** **(** :ref:`bool<class_bool>` value **)**
  593. - :ref:`bool<class_bool>` **is_selecting_enabled** **(** **)**
  594. If ``false``, it's impossible to select the text using mouse nor keyboard.
  595. .. rst-class:: classref-item-separator
  596. ----
  597. .. _class_LineEdit_property_shortcut_keys_enabled:
  598. .. rst-class:: classref-property
  599. :ref:`bool<class_bool>` **shortcut_keys_enabled** = ``true``
  600. .. rst-class:: classref-property-setget
  601. - void **set_shortcut_keys_enabled** **(** :ref:`bool<class_bool>` value **)**
  602. - :ref:`bool<class_bool>` **is_shortcut_keys_enabled** **(** **)**
  603. If ``false``, using shortcuts will be disabled.
  604. .. rst-class:: classref-item-separator
  605. ----
  606. .. _class_LineEdit_property_structured_text_bidi_override:
  607. .. rst-class:: classref-property
  608. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0``
  609. .. rst-class:: classref-property-setget
  610. - void **set_structured_text_bidi_override** **(** :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` value **)**
  611. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override** **(** **)**
  612. Set BiDi algorithm override for the structured text.
  613. .. rst-class:: classref-item-separator
  614. ----
  615. .. _class_LineEdit_property_structured_text_bidi_override_options:
  616. .. rst-class:: classref-property
  617. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]``
  618. .. rst-class:: classref-property-setget
  619. - void **set_structured_text_bidi_override_options** **(** :ref:`Array<class_Array>` value **)**
  620. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options** **(** **)**
  621. Set additional options for BiDi override.
  622. .. rst-class:: classref-item-separator
  623. ----
  624. .. _class_LineEdit_property_text:
  625. .. rst-class:: classref-property
  626. :ref:`String<class_String>` **text** = ``""``
  627. .. rst-class:: classref-property-setget
  628. - void **set_text** **(** :ref:`String<class_String>` value **)**
  629. - :ref:`String<class_String>` **get_text** **(** **)**
  630. String value of the **LineEdit**.
  631. \ **Note:** Changing text using this property won't emit the :ref:`text_changed<class_LineEdit_signal_text_changed>` signal.
  632. .. rst-class:: classref-item-separator
  633. ----
  634. .. _class_LineEdit_property_text_direction:
  635. .. rst-class:: classref-property
  636. :ref:`TextDirection<enum_Control_TextDirection>` **text_direction** = ``0``
  637. .. rst-class:: classref-property-setget
  638. - void **set_text_direction** **(** :ref:`TextDirection<enum_Control_TextDirection>` value **)**
  639. - :ref:`TextDirection<enum_Control_TextDirection>` **get_text_direction** **(** **)**
  640. Base text writing direction.
  641. .. rst-class:: classref-item-separator
  642. ----
  643. .. _class_LineEdit_property_virtual_keyboard_enabled:
  644. .. rst-class:: classref-property
  645. :ref:`bool<class_bool>` **virtual_keyboard_enabled** = ``true``
  646. .. rst-class:: classref-property-setget
  647. - void **set_virtual_keyboard_enabled** **(** :ref:`bool<class_bool>` value **)**
  648. - :ref:`bool<class_bool>` **is_virtual_keyboard_enabled** **(** **)**
  649. If ``true``, the native virtual keyboard is shown when focused on platforms that support it.
  650. .. rst-class:: classref-item-separator
  651. ----
  652. .. _class_LineEdit_property_virtual_keyboard_type:
  653. .. rst-class:: classref-property
  654. :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **virtual_keyboard_type** = ``0``
  655. .. rst-class:: classref-property-setget
  656. - void **set_virtual_keyboard_type** **(** :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` value **)**
  657. - :ref:`VirtualKeyboardType<enum_LineEdit_VirtualKeyboardType>` **get_virtual_keyboard_type** **(** **)**
  658. Specifies the type of virtual keyboard to show.
  659. .. rst-class:: classref-section-separator
  660. ----
  661. .. rst-class:: classref-descriptions-group
  662. Method Descriptions
  663. -------------------
  664. .. _class_LineEdit_method_clear:
  665. .. rst-class:: classref-method
  666. void **clear** **(** **)**
  667. Erases the **LineEdit**'s :ref:`text<class_LineEdit_property_text>`.
  668. .. rst-class:: classref-item-separator
  669. ----
  670. .. _class_LineEdit_method_delete_char_at_caret:
  671. .. rst-class:: classref-method
  672. void **delete_char_at_caret** **(** **)**
  673. Deletes one character at the caret's current position (equivalent to pressing :kbd:`Delete`).
  674. .. rst-class:: classref-item-separator
  675. ----
  676. .. _class_LineEdit_method_delete_text:
  677. .. rst-class:: classref-method
  678. void **delete_text** **(** :ref:`int<class_int>` from_column, :ref:`int<class_int>` to_column **)**
  679. 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.
  680. .. rst-class:: classref-item-separator
  681. ----
  682. .. _class_LineEdit_method_deselect:
  683. .. rst-class:: classref-method
  684. void **deselect** **(** **)**
  685. Clears the current selection.
  686. .. rst-class:: classref-item-separator
  687. ----
  688. .. _class_LineEdit_method_get_menu:
  689. .. rst-class:: classref-method
  690. :ref:`PopupMenu<class_PopupMenu>` **get_menu** **(** **)** |const|
  691. Returns the :ref:`PopupMenu<class_PopupMenu>` of this **LineEdit**. By default, this menu is displayed when right-clicking on the **LineEdit**.
  692. You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see :ref:`MenuItems<enum_LineEdit_MenuItems>`). For example:
  693. .. tabs::
  694. .. code-tab:: gdscript
  695. func _ready():
  696. var menu = get_menu()
  697. # Remove all items after "Redo".
  698. menu.item_count = menu.get_item_index(MENU_REDO) + 1
  699. # Add custom items.
  700. menu.add_separator()
  701. menu.add_item("Insert Date", MENU_MAX + 1)
  702. # Connect callback.
  703. menu.id_pressed.connect(_on_item_pressed)
  704. func _on_item_pressed(id):
  705. if id == MENU_MAX + 1:
  706. insert_text_at_caret(Time.get_date_string_from_system())
  707. .. code-tab:: csharp
  708. public override void _Ready()
  709. {
  710. var menu = GetMenu();
  711. // Remove all items after "Redo".
  712. menu.ItemCount = menu.GetItemIndex(LineEdit.MenuItems.Redo) + 1;
  713. // Add custom items.
  714. menu.AddSeparator();
  715. menu.AddItem("Insert Date", LineEdit.MenuItems.Max + 1);
  716. // Add event handler.
  717. menu.IdPressed += OnItemPressed;
  718. }
  719. public void OnItemPressed(int id)
  720. {
  721. if (id == LineEdit.MenuItems.Max + 1)
  722. {
  723. InsertTextAtCaret(Time.GetDateStringFromSystem());
  724. }
  725. }
  726. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`Window.visible<class_Window_property_visible>` property.
  727. .. rst-class:: classref-item-separator
  728. ----
  729. .. _class_LineEdit_method_get_scroll_offset:
  730. .. rst-class:: classref-method
  731. :ref:`float<class_float>` **get_scroll_offset** **(** **)** |const|
  732. Returns the scroll offset due to :ref:`caret_column<class_LineEdit_property_caret_column>`, as a number of characters.
  733. .. rst-class:: classref-item-separator
  734. ----
  735. .. _class_LineEdit_method_get_selection_from_column:
  736. .. rst-class:: classref-method
  737. :ref:`int<class_int>` **get_selection_from_column** **(** **)** |const|
  738. Returns the selection begin column.
  739. .. rst-class:: classref-item-separator
  740. ----
  741. .. _class_LineEdit_method_get_selection_to_column:
  742. .. rst-class:: classref-method
  743. :ref:`int<class_int>` **get_selection_to_column** **(** **)** |const|
  744. Returns the selection end column.
  745. .. rst-class:: classref-item-separator
  746. ----
  747. .. _class_LineEdit_method_has_selection:
  748. .. rst-class:: classref-method
  749. :ref:`bool<class_bool>` **has_selection** **(** **)** |const|
  750. Returns ``true`` if the user has selected text.
  751. .. rst-class:: classref-item-separator
  752. ----
  753. .. _class_LineEdit_method_insert_text_at_caret:
  754. .. rst-class:: classref-method
  755. void **insert_text_at_caret** **(** :ref:`String<class_String>` text **)**
  756. Inserts ``text`` at the caret. If the resulting value is longer than :ref:`max_length<class_LineEdit_property_max_length>`, nothing happens.
  757. .. rst-class:: classref-item-separator
  758. ----
  759. .. _class_LineEdit_method_is_menu_visible:
  760. .. rst-class:: classref-method
  761. :ref:`bool<class_bool>` **is_menu_visible** **(** **)** |const|
  762. Returns whether the menu is visible. Use this instead of ``get_menu().visible`` to improve performance (so the creation of the menu is avoided).
  763. .. rst-class:: classref-item-separator
  764. ----
  765. .. _class_LineEdit_method_menu_option:
  766. .. rst-class:: classref-method
  767. void **menu_option** **(** :ref:`int<class_int>` option **)**
  768. Executes a given action as defined in the :ref:`MenuItems<enum_LineEdit_MenuItems>` enum.
  769. .. rst-class:: classref-item-separator
  770. ----
  771. .. _class_LineEdit_method_select:
  772. .. rst-class:: classref-method
  773. void **select** **(** :ref:`int<class_int>` from=0, :ref:`int<class_int>` to=-1 **)**
  774. Selects characters inside **LineEdit** between ``from`` and ``to``. By default, ``from`` is at the beginning and ``to`` at the end.
  775. .. tabs::
  776. .. code-tab:: gdscript
  777. text = "Welcome"
  778. select() # Will select "Welcome".
  779. select(4) # Will select "ome".
  780. select(2, 5) # Will select "lco".
  781. .. code-tab:: csharp
  782. Text = "Welcome";
  783. Select(); // Will select "Welcome".
  784. Select(4); // Will select "ome".
  785. Select(2, 5); // Will select "lco".
  786. .. rst-class:: classref-item-separator
  787. ----
  788. .. _class_LineEdit_method_select_all:
  789. .. rst-class:: classref-method
  790. void **select_all** **(** **)**
  791. Selects the whole :ref:`String<class_String>`.
  792. .. rst-class:: classref-section-separator
  793. ----
  794. .. rst-class:: classref-descriptions-group
  795. Theme Property Descriptions
  796. ---------------------------
  797. .. _class_LineEdit_theme_color_caret_color:
  798. .. rst-class:: classref-themeproperty
  799. :ref:`Color<class_Color>` **caret_color** = ``Color(0.95, 0.95, 0.95, 1)``
  800. Color of the **LineEdit**'s caret (text cursor). This can be set to a fully transparent color to hide the caret entirely.
  801. .. rst-class:: classref-item-separator
  802. ----
  803. .. _class_LineEdit_theme_color_clear_button_color:
  804. .. rst-class:: classref-themeproperty
  805. :ref:`Color<class_Color>` **clear_button_color** = ``Color(0.875, 0.875, 0.875, 1)``
  806. Color used as default tint for the clear button.
  807. .. rst-class:: classref-item-separator
  808. ----
  809. .. _class_LineEdit_theme_color_clear_button_color_pressed:
  810. .. rst-class:: classref-themeproperty
  811. :ref:`Color<class_Color>` **clear_button_color_pressed** = ``Color(1, 1, 1, 1)``
  812. Color used for the clear button when it's pressed.
  813. .. rst-class:: classref-item-separator
  814. ----
  815. .. _class_LineEdit_theme_color_font_color:
  816. .. rst-class:: classref-themeproperty
  817. :ref:`Color<class_Color>` **font_color** = ``Color(0.875, 0.875, 0.875, 1)``
  818. Default font color.
  819. .. rst-class:: classref-item-separator
  820. ----
  821. .. _class_LineEdit_theme_color_font_outline_color:
  822. .. rst-class:: classref-themeproperty
  823. :ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
  824. The tint of text outline of the **LineEdit**.
  825. .. rst-class:: classref-item-separator
  826. ----
  827. .. _class_LineEdit_theme_color_font_placeholder_color:
  828. .. rst-class:: classref-themeproperty
  829. :ref:`Color<class_Color>` **font_placeholder_color** = ``Color(0.875, 0.875, 0.875, 0.6)``
  830. Font color for :ref:`placeholder_text<class_LineEdit_property_placeholder_text>`.
  831. .. rst-class:: classref-item-separator
  832. ----
  833. .. _class_LineEdit_theme_color_font_selected_color:
  834. .. rst-class:: classref-themeproperty
  835. :ref:`Color<class_Color>` **font_selected_color** = ``Color(1, 1, 1, 1)``
  836. Font color for selected text (inside the selection rectangle).
  837. .. rst-class:: classref-item-separator
  838. ----
  839. .. _class_LineEdit_theme_color_font_uneditable_color:
  840. .. rst-class:: classref-themeproperty
  841. :ref:`Color<class_Color>` **font_uneditable_color** = ``Color(0.875, 0.875, 0.875, 0.5)``
  842. Font color when editing is disabled.
  843. .. rst-class:: classref-item-separator
  844. ----
  845. .. _class_LineEdit_theme_color_selection_color:
  846. .. rst-class:: classref-themeproperty
  847. :ref:`Color<class_Color>` **selection_color** = ``Color(0.5, 0.5, 0.5, 1)``
  848. Color of the selection rectangle.
  849. .. rst-class:: classref-item-separator
  850. ----
  851. .. _class_LineEdit_theme_constant_caret_width:
  852. .. rst-class:: classref-themeproperty
  853. :ref:`int<class_int>` **caret_width** = ``1``
  854. The caret's width in pixels. Greater values can be used to improve accessibility by ensuring the caret is easily visible, or to ensure consistency with a large font size.
  855. .. rst-class:: classref-item-separator
  856. ----
  857. .. _class_LineEdit_theme_constant_minimum_character_width:
  858. .. rst-class:: classref-themeproperty
  859. :ref:`int<class_int>` **minimum_character_width** = ``4``
  860. Minimum horizontal space for the text (not counting the clear button and content margins). This value is measured in count of 'M' characters (i.e. this number of 'M' characters can be displayed without scrolling).
  861. .. rst-class:: classref-item-separator
  862. ----
  863. .. _class_LineEdit_theme_constant_outline_size:
  864. .. rst-class:: classref-themeproperty
  865. :ref:`int<class_int>` **outline_size** = ``0``
  866. The size of the text outline.
  867. \ **Note:** If using a font with :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` enabled, its :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` must be set to at least *twice* the value of :ref:`outline_size<class_LineEdit_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  868. .. rst-class:: classref-item-separator
  869. ----
  870. .. _class_LineEdit_theme_font_font:
  871. .. rst-class:: classref-themeproperty
  872. :ref:`Font<class_Font>` **font**
  873. Font used for the text.
  874. .. rst-class:: classref-item-separator
  875. ----
  876. .. _class_LineEdit_theme_font_size_font_size:
  877. .. rst-class:: classref-themeproperty
  878. :ref:`int<class_int>` **font_size**
  879. Font size of the **LineEdit**'s text.
  880. .. rst-class:: classref-item-separator
  881. ----
  882. .. _class_LineEdit_theme_icon_clear:
  883. .. rst-class:: classref-themeproperty
  884. :ref:`Texture2D<class_Texture2D>` **clear**
  885. Texture for the clear button. See :ref:`clear_button_enabled<class_LineEdit_property_clear_button_enabled>`.
  886. .. rst-class:: classref-item-separator
  887. ----
  888. .. _class_LineEdit_theme_style_focus:
  889. .. rst-class:: classref-themeproperty
  890. :ref:`StyleBox<class_StyleBox>` **focus**
  891. Background used when **LineEdit** has GUI focus. The ``focus`` :ref:`StyleBox<class_StyleBox>` is displayed *over* the base :ref:`StyleBox<class_StyleBox>`, so a partially transparent :ref:`StyleBox<class_StyleBox>` should be used to ensure the base :ref:`StyleBox<class_StyleBox>` remains visible. A :ref:`StyleBox<class_StyleBox>` that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a :ref:`StyleBoxEmpty<class_StyleBoxEmpty>` resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
  892. .. rst-class:: classref-item-separator
  893. ----
  894. .. _class_LineEdit_theme_style_normal:
  895. .. rst-class:: classref-themeproperty
  896. :ref:`StyleBox<class_StyleBox>` **normal**
  897. Default background for the **LineEdit**.
  898. .. rst-class:: classref-item-separator
  899. ----
  900. .. _class_LineEdit_theme_style_read_only:
  901. .. rst-class:: classref-themeproperty
  902. :ref:`StyleBox<class_StyleBox>` **read_only**
  903. Background used when **LineEdit** is in read-only mode (:ref:`editable<class_LineEdit_property_editable>` is set to ``false``).
  904. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  905. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  906. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  907. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  908. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  909. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`