LineEdit

Inherits: Control < CanvasItem < Node < Object

Category: Core

Brief Description

Control that provides single line string editing.

Member Functions

void append_at_cursor ( String text )
void clear ( )
bool cursor_get_blink_enabled ( ) const
float cursor_get_blink_speed ( ) const
void cursor_set_blink_enabled ( bool enabled )
void cursor_set_blink_speed ( float blink_speed )
int get_align ( ) const
int get_cursor_pos ( ) const
bool get_expand_to_text_length ( ) const
int get_max_length ( ) const
PopupMenu get_menu ( ) const
String get_placeholder ( ) const
float get_placeholder_alpha ( ) const
String get_text ( ) const
bool is_editable ( ) const
bool is_secret ( ) const
void menu_option ( int option )
void select ( int from=-1, int to=0 )
void select_all ( )
void set_align ( int align )
void set_cursor_pos ( int pos )
void set_editable ( bool enabled )
void set_expand_to_text_length ( bool enabled )
void set_max_length ( int chars )
void set_placeholder ( String text )
void set_placeholder_alpha ( float alpha )
void set_secret ( bool enabled )
void set_text ( String text )

Signals

  • text_changed ( String text )

When the text changes, this signal is emitted.

  • text_entered ( String text )

This signal is emitted when the user presses KEY_ENTER on the LineEdit. This signal is often used as an alternate confirmation mechanism in dialogs.

Numeric Constants

  • ALIGN_LEFT = 0
  • ALIGN_CENTER = 1
  • ALIGN_RIGHT = 2
  • ALIGN_FILL = 3
  • MENU_CUT = 0
  • MENU_COPY = 1
  • MENU_PASTE = 2
  • MENU_CLEAR = 3
  • MENU_SELECT_ALL = 4
  • MENU_UNDO = 5
  • MENU_MAX = 6

Description

LineEdit provides a single line string editor, used for text fields.

Member Function Description

  • void append_at_cursor ( String text )

Append text at cursor, scrolling the LineEdit when needed.

  • void clear ( )

Clear the LineEdit text.

Gets whether the line edit caret is blinking.

Gets the line edit caret blink speed.

Set the line edit caret to blink.

Set the line edit caret blink speed. Cannot be less then or equal to 0.

  • int get_align ( ) const
  • int get_cursor_pos ( ) const

Return the cursor position inside the LineEdit.

  • bool get_expand_to_text_length ( ) const
  • int get_max_length ( ) const

Return the maximum amount of characters the LineEdit can edit. If 0 is returned, no limit exists.

  • String get_placeholder ( ) const
  • float get_placeholder_alpha ( ) const

Return the text in the LineEdit.

  • bool is_editable ( ) const

Return the editable status of the LineEdit (see set_editable).

  • bool is_secret ( ) const

Return the secret status of the LineEdit (see set_secret).

  • void menu_option ( int option )
  • void select ( int from=-1, int to=0 )
  • void select_all ( )

Select the whole string.

  • void set_align ( int align )
  • void set_cursor_pos ( int pos )

Set the cursor position inside the LineEdit, causing it to scroll if needed.

  • void set_editable ( bool enabled )

Set the editable status of the LineEdit. When disabled, existing text can’t be modified and new text can’t be added.

  • void set_expand_to_text_length ( bool enabled )
  • void set_max_length ( int chars )

Set the maximum amount of characters the LineEdit can edit, and cropping existing text in case it exceeds that limit. Setting 0 removes the limit.

  • void set_placeholder ( String text )
  • void set_placeholder_alpha ( float alpha )
  • void set_secret ( bool enabled )

Set the secret status of the LineEdit. When enabled, every character is displayed as “*”.

  • void set_text ( String text )

Set the text in the LineEdit, clearing the existing one and the selection.