Control that provides single line string editing.
    public class LineEdit : Control

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

Inheritance Chain

Constructors

    public LineEdit()

Signals

    "text_changed" (String new_text)

Emitted when the text changes.

    "text_entered" (String new_text)

Emitted when the user presses KEY_ENTER on the LineEdit.

Properties

    public AlignEnum Align { get; set; }

Text alignment as defined in the ALIGN_* enum.

    public bool CaretBlink { get; set; }

If true the caret (visual cursor) blinks.

    public float CaretBlinkSpeed { get; set; }

Duration (in seconds) of a caret’s blinking cycle.

    public int CaretPosition { get; set; }

The cursor’s position inside the LineEdit. When set, the text may scroll to accommodate it.

    public bool ContextMenuEnabled { get; set; }

If true the context menu will appear when right clicked.

    public bool Editable { get; set; }

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

    public bool ExpandToTextLength { get; set; }

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

    public Control.FocusModeEnum FocusMode { get; set; }

Defines how the LineEdit can grab focus (Keyboard and mouse, only keyboard, or none). See enum FocusMode in Control for details.

    public int MaxLength { get; set; }

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

    public float PlaceholderAlpha { get; set; }

Opacity of the PlaceholderText. From 0 to 1.

    public string PlaceholderText { get; set; }

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

    public bool Secret { get; set; }

If true every character is shown as “*”.

    public string Text { get; set; }

String value of the LineEdit.

Methods

    public void AppendAtCursor(string text)

Adds text after the cursor. If the resulting value is longer than MaxLength, nothing happens.

    public void Clear()

Erases the LineEdit text.

    public bool CursorGetBlinkEnabled()

Getter for CaretBlink

    public float CursorGetBlinkSpeed()

Getter for CaretBlinkSpeed

    public void CursorSetBlinkEnabled(bool enabled)

Setter for CaretBlink

    public void CursorSetBlinkSpeed(float blinkSpeed)

Setter for CaretBlinkSpeed

    public void Deselect()

Clears the current selection.

    public AlignEnum GetAlign()

Getter for Align

    public int GetCursorPosition()

Getter for CaretPosition

    public bool GetExpandToTextLength()

Getter for ExpandToTextLength

    public int GetMaxLength()

Getter for MaxLength

    public PopupMenu GetMenu()

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

    public string GetPlaceholder()

Getter for PlaceholderText

    public float GetPlaceholderAlpha()

Getter for PlaceholderAlpha

    public string GetText()

Getter for Text

    public bool IsContextMenuEnabled()

Getter for ContextMenuEnabled

    public bool IsEditable()

Getter for Editable

    public bool IsSecret()

Getter for Secret

    public void MenuOption(int option)

Executes a given action as defined in the MENU_* enum.

    public void Select(int from = 0, int to = -1)

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

[codeblock]

text = “Welcome”

select() # Welcome

select(4) # ome

select(2, 5) # lco

[/codeblock]

    public void SelectAll()

Selects the whole String.

    public void SetAlign(AlignEnum align)

Setter for Align

    public void SetContextMenuEnabled(bool enable)

Setter for ContextMenuEnabled

    public void SetCursorPosition(int position)

Setter for CaretPosition

    public void SetEditable(bool enabled)

Setter for Editable

    public void SetExpandToTextLength(bool enabled)

Setter for ExpandToTextLength

    public void SetMaxLength(int chars)

Setter for MaxLength

    public void SetPlaceholder(string text)

Setter for PlaceholderText

    public void SetPlaceholderAlpha(float alpha)

Setter for PlaceholderAlpha

    public void SetSecret(bool enabled)

Setter for Secret

    public void SetText(string text)

Setter for Text

Inner Types

AlignEnum

Name Value Description
Left 0 Aligns the text on the left hand side of the [LineEdit].
Center 1 Centers the text in the middle of the [LineEdit].
Right 2 Aligns the text on the right hand side of the [LineEdit].
Fill 3 Stretches whitespaces to fit the [LineEdit]’s width.

Name Value Description
Cut 0 Cuts (Copies and clears) the selected text.
Copy 1 Copies the selected text.
Paste 2 Pastes the clipboard text over the selected text (or at the cursor’s position).
Clear 3 Erases the whole [Linedit] text.
SelectAll 4 Selects the whole [Linedit] text.
Undo 5 Undoes the previous action.
Redo 6  
Max 7  
Tags: