class_lineedit.rst 68 KB

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