class_lineedit.rst 89 KB

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