class_lineedit.rst 69 KB

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