class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectNodeCanvasItemControl LineEdit
An input field for single-line text.

LineEdit provides an input field for editing a single line of text. It features many built-in shortcuts that are always available (Ctrl here maps to Cmd on macOS):

  • Ctrl + C: Copy

  • Ctrl + X: Cut

  • Ctrl + V or Ctrl + Y: Paste/"yank"

  • Ctrl + Z: Undo

  • Ctrl + ~: Swap input direction.

  • Ctrl + Shift + Z: Redo

  • Ctrl + U: Delete text from the caret position to the beginning of the line

  • Ctrl + K: Delete text from the caret position to the end of the line

  • Ctrl + A: Select all text

  • Up Arrow/Down Arrow: Move the caret to the beginning/end of the line

On macOS, some extra keyboard shortcuts are available:

  • Cmd + F: Same as Right Arrow, move the caret one character right

  • Cmd + B: Same as Left Arrow, move the caret one character left

  • Cmd + P: Same as Up Arrow, move the caret to the previous line

  • Cmd + N: Same as Down Arrow, move the caret to the next line

  • Cmd + D: Same as Delete, delete the character on the right side of caret

  • Cmd + H: Same as Backspace, delete the character on the left side of the caret

  • Cmd + A: Same as Home, move the caret to the beginning of the line

  • Cmd + E: Same as End, move the caret to the end of the line

  • Cmd + Left Arrow: Same as Home, move the caret to the beginning of the line

  • Cmd + Right Arrow: Same as End, move the caret to the end of the line

text_change_rejected text_change_rejected<>( String rejected_substring=, rejected_substring:String=, ):text_change_rejected

Emitted when appending text that overflows the max_length. The appended text is truncated to fit max_length, and the part that couldn't fit is passed as the rejected_substring argument.

text_changed text_changed<>( String new_text=, new_text:String=, ):text_changed

Emitted when the text changes.

text_submitted text_submitted<>( String new_text=, new_text:String=, ):text_submitted

Emitted when the user presses @GlobalScope.KEY_ENTER on the LineEdit.

Enum MenuItems<>():Enum

MENU_CUT = 0

Cuts (copies and clears) the selected text.


MENU_COPY = 1

Copies the selected text.


MENU_PASTE = 2

Pastes the clipboard text over the selected text (or at the caret's position).


MENU_CLEAR = 3

Erases the whole LineEdit text.


MENU_SELECT_ALL = 4

Selects the whole LineEdit text.


MENU_UNDO = 5

Undoes the previous action.


MENU_REDO = 6

Reverse the last undo action.


MENU_SUBMENU_TEXT_DIR = 7

ID of "Text Writing Direction" submenu.


MENU_DIR_INHERITED = 8

Sets text direction to inherited.


MENU_DIR_AUTO = 9

Sets text direction to automatic.


MENU_DIR_LTR = 10

Sets text direction to left-to-right.


MENU_DIR_RTL = 11

Sets text direction to right-to-left.


MENU_DISPLAY_UCC = 12

Toggles control character display.


MENU_SUBMENU_INSERT_UCC = 13

ID of "Insert Control Character" submenu.


MENU_INSERT_LRM = 14

Inserts left-to-right mark (LRM) character.


MENU_INSERT_RLM = 15

Inserts right-to-left mark (RLM) character.


MENU_INSERT_LRE = 16

Inserts start of left-to-right embedding (LRE) character.


MENU_INSERT_RLE = 17

Inserts start of right-to-left embedding (RLE) character.


MENU_INSERT_LRO = 18

Inserts start of left-to-right override (LRO) character.


MENU_INSERT_RLO = 19

Inserts start of right-to-left override (RLO) character.


MENU_INSERT_PDF = 20

Inserts pop direction formatting (PDF) character.


MENU_INSERT_ALM = 21

Inserts Arabic letter mark (ALM) character.


MENU_INSERT_LRI = 22

Inserts left-to-right isolate (LRI) character.


MENU_INSERT_RLI = 23

Inserts right-to-left isolate (RLI) character.


MENU_INSERT_FSI = 24

Inserts first strong isolate (FSI) character.


MENU_INSERT_PDI = 25

Inserts pop direction isolate (PDI) character.


MENU_INSERT_ZWJ = 26

Inserts zero width joiner (ZWJ) character.


MENU_INSERT_ZWNJ = 27

Inserts zero width non-joiner (ZWNJ) character.


MENU_INSERT_WJ = 28

Inserts word joiner (WJ) character.


MENU_INSERT_SHY = 29

Inserts soft hyphen (SHY) character.


MENU_MAX = 30

Represents the size of the MenuItems enum.

Enum VirtualKeyboardType<>():Enum

KEYBOARD_TYPE_DEFAULT = 0

Default text virtual keyboard.


KEYBOARD_TYPE_MULTILINE = 1

Multiline virtual keyboard.


KEYBOARD_TYPE_NUMBER = 2

Virtual number keypad, useful for PIN entry.


KEYBOARD_TYPE_NUMBER_DECIMAL = 3

Virtual number keypad, useful for entering fractional numbers.


KEYBOARD_TYPE_PHONE = 4

Virtual phone number keypad.


KEYBOARD_TYPE_EMAIL_ADDRESS = 5

Virtual keyboard with additional keys to assist with typing email addresses.


KEYBOARD_TYPE_PASSWORD = 6

Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization.


KEYBOARD_TYPE_URL = 7

Virtual keyboard with additional keys to assist with typing URLs.

HorizontalAlignment alignment<>():HorizontalAlignment

Text alignment as defined in the HorizontalAlignment enum.

bool caret_blink<>():bool

If true, makes the caret blink.

float caret_blink_interval<>():float

The interval at which the caret blinks (in seconds).

int caret_column<>():int

The caret's column position inside the LineEdit. When set, the text may scroll to accommodate it.

bool caret_force_displayed<>():bool

If true, the LineEdit will always show the caret, even if focus is lost.

bool caret_mid_grapheme<>():bool

Allow moving caret, selecting and removing the individual composite character components.

Note: Backspace is always removing individual composite character components.

bool clear_button_enabled<>():bool

If true, the LineEdit will show a clear button if text is not empty, which can be used to clear the text quickly.

bool context_menu_enabled<>():bool

If true, the context menu will appear when right-clicked.

bool deselect_on_focus_loss_enabled<>():bool

If true, the selected text will be deselected when focus is lost.

bool drag_and_drop_selection_enabled<>():bool

If true, allow drag and drop of selected text.

bool draw_control_chars<>():bool

If true, control characters are displayed.

bool editable<>():bool

If false, existing text cannot be modified and new text cannot be added.

bool expand_to_text_length<>():bool

If true, the LineEdit width will increase to stay longer than the text. It will not compress if the text is shortened.

bool flat<>():bool

If true, the LineEdit doesn't display decoration.

String language<>():String

Language code used for line-breaking and text shaping algorithms. If left empty, current locale is used instead.

int max_length<>():int

Maximum number of characters that can be entered inside the LineEdit. If 0, there is no limit.

When a limit is defined, characters that would exceed max_length are truncated. This happens both for existing text contents when setting the max length, or for new text inserted in the LineEdit, including pasting. If any input text is truncated, the text_change_rejected signal is emitted with the truncated substring as parameter.

Example:

text = "Hello world" max_length = 5 # `text` becomes "Hello". max_length = 10 text += " goodbye" # `text` becomes "Hello good". # `text_change_rejected` is emitted with "bye" as parameter.
bool middle_mouse_paste_enabled<>():bool

If false, using middle mouse button to paste clipboard will be disabled.

Note: This method is only implemented on Linux.

String placeholder_text<>():String

Text shown when the LineEdit is empty. It is not the LineEdit's default value (see text).

Texture2D right_icon<>():Texture2D

Sets the icon that will appear in the right end of the LineEdit if there's no text, or always, if clear_button_enabled is set to false.

bool secret<>():bool

If true, every character is replaced with the secret character (see secret_character).

String secret_character<>():String

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.

bool select_all_on_focus<>():bool

If true, the LineEdit will select the whole text when it gains focus.

bool selecting_enabled<>():bool

If false, it's impossible to select the text using mouse nor keyboard.

bool shortcut_keys_enabled<>():bool

If false, using shortcuts will be disabled.

StructuredTextParser structured_text_bidi_override<>():StructuredTextParser

Set BiDi algorithm override for the structured text.

Array structured_text_bidi_override_options<>():Array

Set additional options for BiDi override.

String text<>():String

String value of the LineEdit.

Note: Changing text using this property won't emit the text_changed signal.

TextDirection text_direction<>():TextDirection

Base text writing direction.

bool virtual_keyboard_enabled<>():bool

If true, the native virtual keyboard is shown when focused on platforms that support it.

VirtualKeyboardType virtual_keyboard_type<>():VirtualKeyboardType

Specifies the type of virtual keyboard to show.

void clear<>():void

Erases the LineEdit's text.

void delete_char_at_caret<>():void

Deletes one character at the caret's current position (equivalent to pressing Delete).

void delete_text<>( int from_column=, from_column:int=, int to_column=, to_column:int=, ):void

Deletes a section of the text going from position from_column to to_column. Both parameters should be within the text's length.

void deselect<>():void

Clears the current selection.

PopupMenu get_menu<>():PopupMenu

Returns the PopupMenu of this LineEdit. By default, this menu is displayed when right-clicking on the LineEdit.

You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see MenuItems). For example:

func _ready(): var menu = get_menu() # Remove all items after "Redo". menu.item_count = menu.get_item_index(MENU_REDO) + 1 # Add custom items. menu.add_separator() menu.add_item("Insert Date", MENU_MAX + 1) # Connect callback. menu.id_pressed.connect(_on_item_pressed) func _on_item_pressed(id): if id == MENU_MAX + 1: insert_text_at_caret(Time.get_date_string_from_system())

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 Window.visible property.

float get_scroll_offset<>():float

Returns the scroll offset due to caret_column, as a number of characters.

String get_selected_text<>():String

Returns the text inside the selection.

int get_selection_from_column<>():int

Returns the selection begin column.

int get_selection_to_column<>():int

Returns the selection end column.

bool has_selection<>():bool

Returns true if the user has selected text.

void insert_text_at_caret<>( String text=, text:String=, ):void

Inserts text at the caret. If the resulting value is longer than max_length, nothing happens.

bool is_menu_visible<>():bool

Returns whether the menu is visible. Use this instead of get_menu().visible to improve performance (so the creation of the menu is avoided).

void menu_option<>( int option=, option:int=, ):void

Executes a given action as defined in the MenuItems enum.

void select<>( int from=0, from:int=0, int=, int:=, ):void

Selects characters inside LineEdit between from and to. By default, from is at the beginning and to at the end.

text = "Welcome" select() # Will select "Welcome". select(4) # Will select "ome". select(2, 5) # Will select "lco".
void select_all<>():void

Selects the whole String.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...