LineEdit

Control that provides single-line string editing.

LineEdit provides a single-line string editor, used for text fields. It features many built-in shortcuts which will always be available (Ctrl here maps to Command on macOS): - Ctrl + C: Copy - Ctrl + X: Cut - Ctrl + V or Ctrl + Y: Paste/"yank" - Ctrl + Z: Undo - Ctrl + Shift + Z: Redo - Ctrl + U: Delete text from the cursor position to the beginning of the line - Ctrl + K: Delete text from the cursor position to the end of the line - Ctrl + A: Select all text - Up/Down arrow: Move the cursor to the beginning/end of the line On macOS, some extra keyboard shortcuts are available: - Ctrl + F: Like the right arrow key, move the cursor one character right - Ctrl + B: Like the left arrow key, move the cursor one character left - Ctrl + P: Like the up arrow key, move the cursor to the previous line - Ctrl + N: Like the down arrow key, move the cursor to the next line - Ctrl + D: Like the Delete key, delete the character on the right side of cursor - Ctrl + H: Like the Backspace key, delete the character on the left side of the cursor - Command + Left arrow: Like the Home key, move the cursor to the beginning of the line - Command + Right arrow: Like the End key, move the cursor to the end of the line

@GodotBaseClass
struct LineEdit {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Align
enum Align
Constants
enum Constants
MenuItems
enum MenuItems

Functions

_editorSettingsChanged
void _editorSettingsChanged()
_guiInput
void _guiInput(InputEvent arg0)
_textChanged
void _textChanged()
_toggleDrawCaret
void _toggleDrawCaret()
appendAtCursor
void appendAtCursor(String text)

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

clear
void clear()

Erases the LineEdit's text.

cursorGetBlinkEnabled
bool cursorGetBlinkEnabled()
cursorGetBlinkSpeed
double cursorGetBlinkSpeed()
cursorSetBlinkEnabled
void cursorSetBlinkEnabled(bool enabled)
cursorSetBlinkSpeed
void cursorSetBlinkSpeed(double blink_speed)
deleteCharAtCursor
void deleteCharAtCursor()

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

deleteText
void deleteText(long from_column, long to_column)

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

deselect
void deselect()

Clears the current selection.

getAlign
LineEdit.Align getAlign()
getCursorPosition
long getCursorPosition()
getExpandToTextLength
bool getExpandToTextLength()
getMaxLength
long getMaxLength()
getMenu
PopupMenu getMenu()

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

getPlaceholder
String getPlaceholder()
getPlaceholderAlpha
double getPlaceholderAlpha()
getRightIcon
Ref!Texture getRightIcon()
getScrollOffset
long getScrollOffset()

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

getSecretCharacter
String getSecretCharacter()
getText
String getText()
isClearButtonEnabled
bool isClearButtonEnabled()
isContextMenuEnabled
bool isContextMenuEnabled()
isEditable
bool isEditable()
isSecret
bool isSecret()
isSelectingEnabled
bool isSelectingEnabled()
isShortcutKeysEnabled
bool isShortcutKeysEnabled()
isVirtualKeyboardEnabled
bool isVirtualKeyboardEnabled()
menuOption
void menuOption(long option)

Executes a given action as defined in the menuitems enum.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(LineEdit other)
opEquals
bool opEquals(typeof(null) n)
select
void select(long from, long to)

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

selectAll
void selectAll()

Selects the whole String.

setAlign
void setAlign(long _align)
setClearButtonEnabled
void setClearButtonEnabled(bool enable)
setContextMenuEnabled
void setContextMenuEnabled(bool enable)
setCursorPosition
void setCursorPosition(long position)
setEditable
void setEditable(bool enabled)
setExpandToTextLength
void setExpandToTextLength(bool enabled)
setMaxLength
void setMaxLength(long chars)
setPlaceholder
void setPlaceholder(String text)
setPlaceholderAlpha
void setPlaceholderAlpha(double alpha)
setRightIcon
void setRightIcon(Texture icon)
setSecret
void setSecret(bool enabled)
setSecretCharacter
void setSecretCharacter(String character)
setSelectingEnabled
void setSelectingEnabled(bool enable)
setShortcutKeysEnabled
void setShortcutKeysEnabled(bool enable)
setText
void setText(String text)
setVirtualKeyboardEnabled
void setVirtualKeyboardEnabled(bool enable)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

_align
LineEdit.Align _align [@property getter]
long _align [@property setter]

Text alignment as defined in the _align enum.

caretBlink
bool caretBlink [@property getter]
bool caretBlink [@property setter]

If true, the caret (visual cursor) blinks.

caretBlinkSpeed
double caretBlinkSpeed [@property getter]
double caretBlinkSpeed [@property setter]

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

caretPosition
long caretPosition [@property getter]
long caretPosition [@property setter]

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

clearButtonEnabled
bool clearButtonEnabled [@property getter]
bool clearButtonEnabled [@property setter]

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

contextMenuEnabled
bool contextMenuEnabled [@property getter]
bool contextMenuEnabled [@property setter]

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

editable
bool editable [@property getter]
bool editable [@property setter]

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

expandToTextLength
bool expandToTextLength [@property getter]
bool expandToTextLength [@property setter]

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

maxLength
long maxLength [@property getter]
long maxLength [@property setter]

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

placeholderAlpha
double placeholderAlpha [@property getter]
double placeholderAlpha [@property setter]

Opacity of the placeholderText. From 0 to 1.

placeholderText
String placeholderText [@property getter]
String placeholderText [@property setter]

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

rightIcon
Texture rightIcon [@property getter]
Texture rightIcon [@property setter]

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

secret
bool secret [@property getter]
bool secret [@property setter]

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

secretCharacter
String secretCharacter [@property getter]
String secretCharacter [@property setter]

The character to use to mask secret input (defaults to "*"). Only a single character can be used as the secret character.

selectingEnabled
bool selectingEnabled [@property getter]
bool selectingEnabled [@property setter]

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

shortcutKeysEnabled
bool shortcutKeysEnabled [@property getter]
bool shortcutKeysEnabled [@property setter]

If false, using shortcuts will be disabled.

text
String text [@property getter]
String text [@property setter]

String value of the LineEdit. Note: Changing text using this property won't emit the textChanged signal.

virtualKeyboardEnabled
bool virtualKeyboardEnabled [@property getter]
bool virtualKeyboardEnabled [@property setter]

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

Static functions

_new
LineEdit _new()

Construct a new instance of LineEdit. Note: use memnew!LineEdit instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta