class_lineedit.rst 88 KB

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