Documentation
¶
Overview ¶
Package LineEdit provides methods for working with LineEdit object instances.
Index ¶
- type Advanced
- type Any
- type HorizontalAlignment
- type Instance
- func (self Instance) Alignment() HorizontalAlignment
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsControl() Control.Instance
- func (self Instance) AsLineEdit() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) CaretBlink() bool
- func (self Instance) CaretBlinkInterval() Float.X
- func (self Instance) CaretColumn() int
- func (self Instance) CaretForceDisplayed() bool
- func (self Instance) CaretMidGrapheme() bool
- func (self Instance) Clear()
- func (self Instance) ClearButtonEnabled() bool
- func (self Instance) ContextMenuEnabled() bool
- func (self Instance) DeleteCharAtCaret()
- func (self Instance) DeleteText(from_column int, to_column int)
- func (self Instance) Deselect()
- func (self Instance) DeselectOnFocusLossEnabled() bool
- func (self Instance) DragAndDropSelectionEnabled() bool
- func (self Instance) DrawControlChars() bool
- func (self Instance) Editable() bool
- func (self Instance) ExpandToTextLength() bool
- func (self Instance) Flat() bool
- func (self Instance) GetMenu() [1]gdclass.PopupMenu
- func (self Instance) GetScrollOffset() Float.X
- func (self Instance) GetSelectedText() string
- func (self Instance) GetSelectionFromColumn() int
- func (self Instance) GetSelectionToColumn() int
- func (self Instance) HasSelection() bool
- func (self Instance) InsertTextAtCaret(text string)
- func (self Instance) IsMenuVisible() bool
- func (self Instance) Language() string
- func (self Instance) MaxLength() int
- func (self Instance) MenuOption(option int)
- func (self Instance) MiddleMousePasteEnabled() bool
- func (self Instance) OnTextChangeRejected(cb func(rejected_substring string))
- func (self Instance) OnTextChanged(cb func(new_text string))
- func (self Instance) OnTextSubmitted(cb func(new_text string))
- func (self Instance) PlaceholderText() string
- func (self Instance) RightIcon() [1]gdclass.Texture2D
- func (self Instance) Secret() bool
- func (self Instance) SecretCharacter() string
- func (self Instance) Select()
- func (self Instance) SelectAll()
- func (self Instance) SelectAllOnFocus() bool
- func (self Instance) SelectingEnabled() bool
- func (self Instance) SetAlignment(value HorizontalAlignment)
- func (self Instance) SetCaretBlink(value bool)
- func (self Instance) SetCaretBlinkInterval(value Float.X)
- func (self Instance) SetCaretColumn(value int)
- func (self Instance) SetCaretForceDisplayed(value bool)
- func (self Instance) SetCaretMidGrapheme(value bool)
- func (self Instance) SetClearButtonEnabled(value bool)
- func (self Instance) SetContextMenuEnabled(value bool)
- func (self Instance) SetDeselectOnFocusLossEnabled(value bool)
- func (self Instance) SetDragAndDropSelectionEnabled(value bool)
- func (self Instance) SetDrawControlChars(value bool)
- func (self Instance) SetEditable(value bool)
- func (self Instance) SetExpandToTextLength(value bool)
- func (self Instance) SetFlat(value bool)
- func (self Instance) SetLanguage(value string)
- func (self Instance) SetMaxLength(value int)
- func (self Instance) SetMiddleMousePasteEnabled(value bool)
- func (self Instance) SetPlaceholderText(value string)
- func (self Instance) SetRightIcon(value [1]gdclass.Texture2D)
- func (self Instance) SetSecret(value bool)
- func (self Instance) SetSecretCharacter(value string)
- func (self Instance) SetSelectAllOnFocus(value bool)
- func (self Instance) SetSelectingEnabled(value bool)
- func (self Instance) SetShortcutKeysEnabled(value bool)
- func (self Instance) SetStructuredTextBidiOverride(value gdclass.TextServerStructuredTextParser)
- func (self Instance) SetStructuredTextBidiOverrideOptions(value []any)
- func (self Instance) SetText(value string)
- func (self Instance) SetTextDirection(value gdclass.ControlTextDirection)
- func (self Instance) SetVirtualKeyboardEnabled(value bool)
- func (self Instance) SetVirtualKeyboardType(value gdclass.LineEditVirtualKeyboardType)
- func (self Instance) ShortcutKeysEnabled() bool
- func (self Instance) StructuredTextBidiOverride() gdclass.TextServerStructuredTextParser
- func (self Instance) StructuredTextBidiOverrideOptions() []any
- func (self Instance) Text() string
- func (self Instance) TextDirection() gdclass.ControlTextDirection
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VirtualKeyboardEnabled() bool
- func (self Instance) VirtualKeyboardType() gdclass.LineEditVirtualKeyboardType
- type MenuItems
- type VirtualKeyboardType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type HorizontalAlignment ¶
type HorizontalAlignment int
const ( /*Horizontal left alignment, usually for text-derived classes.*/ HorizontalAlignmentLeft HorizontalAlignment = 0 /*Horizontal center alignment, usually for text-derived classes.*/ HorizontalAlignmentCenter HorizontalAlignment = 1 /*Horizontal right alignment, usually for text-derived classes.*/ HorizontalAlignmentRight HorizontalAlignment = 2 /*Expand row to fit width, usually for text-derived classes.*/ HorizontalAlignmentFill HorizontalAlignment = 3 )
type Instance ¶
[LineEdit] provides an input field for editing a single line of text. It features many built-in shortcuts that are always available ([kbd]Ctrl[/kbd] here maps to [kbd]Cmd[/kbd] on macOS): - [kbd]Ctrl + C[/kbd]: Copy - [kbd]Ctrl + X[/kbd]: Cut - [kbd]Ctrl + V[/kbd] or [kbd]Ctrl + Y[/kbd]: Paste/"yank" - [kbd]Ctrl + Z[/kbd]: Undo - [kbd]Ctrl + ~[/kbd]: Swap input direction. - [kbd]Ctrl + Shift + Z[/kbd]: Redo - [kbd]Ctrl + U[/kbd]: Delete text from the caret position to the beginning of the line - [kbd]Ctrl + K[/kbd]: Delete text from the caret position to the end of the line - [kbd]Ctrl + A[/kbd]: Select all text - [kbd]Up Arrow[/kbd]/[kbd]Down Arrow[/kbd]: Move the caret to the beginning/end of the line On macOS, some extra keyboard shortcuts are available: - [kbd]Cmd + F[/kbd]: Same as [kbd]Right Arrow[/kbd], move the caret one character right - [kbd]Cmd + B[/kbd]: Same as [kbd]Left Arrow[/kbd], move the caret one character left - [kbd]Cmd + P[/kbd]: Same as [kbd]Up Arrow[/kbd], move the caret to the previous line - [kbd]Cmd + N[/kbd]: Same as [kbd]Down Arrow[/kbd], move the caret to the next line - [kbd]Cmd + D[/kbd]: Same as [kbd]Delete[/kbd], delete the character on the right side of caret - [kbd]Cmd + H[/kbd]: Same as [kbd]Backspace[/kbd], delete the character on the left side of the caret - [kbd]Cmd + A[/kbd]: Same as [kbd]Home[/kbd], move the caret to the beginning of the line - [kbd]Cmd + E[/kbd]: Same as [kbd]End[/kbd], move the caret to the end of the line - [kbd]Cmd + Left Arrow[/kbd]: Same as [kbd]Home[/kbd], move the caret to the beginning of the line - [kbd]Cmd + Right Arrow[/kbd]: Same as [kbd]End[/kbd], move the caret to the end of the line
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) Alignment ¶
func (self Instance) Alignment() HorizontalAlignment
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsLineEdit ¶
func (Instance) CaretBlink ¶
func (Instance) CaretBlinkInterval ¶
func (Instance) CaretColumn ¶
func (Instance) CaretForceDisplayed ¶
func (Instance) CaretMidGrapheme ¶
func (Instance) ClearButtonEnabled ¶
func (Instance) ContextMenuEnabled ¶
func (Instance) DeleteCharAtCaret ¶
func (self Instance) DeleteCharAtCaret()
Deletes one character at the caret's current position (equivalent to pressing [kbd]Delete[/kbd]).
func (Instance) DeleteText ¶
Deletes a section of the [member text] going from position [param from_column] to [param to_column]. Both parameters should be within the text's length.
func (Instance) DeselectOnFocusLossEnabled ¶
func (Instance) DragAndDropSelectionEnabled ¶
func (Instance) DrawControlChars ¶
func (Instance) ExpandToTextLength ¶
func (Instance) GetMenu ¶
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 [enum MenuItems]). For example: [codeblocks] [gdscript] 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())
[/gdscript] [csharp] public override void _Ready()
{ var menu = GetMenu(); // Remove all items after "Redo". menu.ItemCount = menu.GetItemIndex(LineEdit.MenuItems.Redo) + 1; // Add custom items. menu.AddSeparator(); menu.AddItem("Insert Date", LineEdit.MenuItems.Max + 1); // Add event handler. menu.IdPressed += OnItemPressed; }
public void OnItemPressed(int id)
{ if (id == LineEdit.MenuItems.Max + 1) { InsertTextAtCaret(Time.GetDateStringFromSystem()); } }
[/csharp] [/codeblocks] [b]Warning:[/b] 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 [member Window.visible] property.
func (Instance) GetScrollOffset ¶
Returns the scroll offset due to [member caret_column], as a number of characters.
func (Instance) GetSelectedText ¶
Returns the text inside the selection.
func (Instance) GetSelectionFromColumn ¶
Returns the selection begin column.
func (Instance) GetSelectionToColumn ¶
Returns the selection end column.
func (Instance) HasSelection ¶
Returns [code]true[/code] if the user has selected text.
func (Instance) InsertTextAtCaret ¶
Inserts [param text] at the caret. If the resulting value is longer than [member max_length], nothing happens.
func (Instance) IsMenuVisible ¶
Returns whether the menu is visible. Use this instead of [code]get_menu().visible[/code] to improve performance (so the creation of the menu is avoided).
func (Instance) MenuOption ¶
Executes a given action as defined in the [enum MenuItems] enum.
func (Instance) MiddleMousePasteEnabled ¶
func (Instance) OnTextChangeRejected ¶
func (Instance) OnTextChanged ¶
func (Instance) OnTextSubmitted ¶
func (Instance) PlaceholderText ¶
func (Instance) SecretCharacter ¶
func (Instance) Select ¶
func (self Instance) Select()
Selects characters inside [LineEdit] between [param from] and [param to]. By default, [param from] is at the beginning and [param to] at the end. [codeblocks] [gdscript] text = "Welcome" select() # Will select "Welcome". select(4) # Will select "ome". select(2, 5) # Will select "lco". [/gdscript] [csharp] Text = "Welcome"; Select(); // Will select "Welcome". Select(4); // Will select "ome". Select(2, 5); // Will select "lco". [/csharp] [/codeblocks]
func (Instance) SelectAllOnFocus ¶
func (Instance) SelectingEnabled ¶
func (Instance) SetAlignment ¶
func (self Instance) SetAlignment(value HorizontalAlignment)
func (Instance) SetCaretBlink ¶
func (Instance) SetCaretBlinkInterval ¶
func (Instance) SetCaretColumn ¶
func (Instance) SetCaretForceDisplayed ¶
func (Instance) SetCaretMidGrapheme ¶
func (Instance) SetClearButtonEnabled ¶
func (Instance) SetContextMenuEnabled ¶
func (Instance) SetDeselectOnFocusLossEnabled ¶
func (Instance) SetDragAndDropSelectionEnabled ¶
func (Instance) SetDrawControlChars ¶
func (Instance) SetEditable ¶
func (Instance) SetExpandToTextLength ¶
func (Instance) SetLanguage ¶
func (Instance) SetMaxLength ¶
func (Instance) SetMiddleMousePasteEnabled ¶
func (Instance) SetPlaceholderText ¶
func (Instance) SetRightIcon ¶
func (Instance) SetSecretCharacter ¶
func (Instance) SetSelectAllOnFocus ¶
func (Instance) SetSelectingEnabled ¶
func (Instance) SetShortcutKeysEnabled ¶
func (Instance) SetStructuredTextBidiOverride ¶
func (self Instance) SetStructuredTextBidiOverride(value gdclass.TextServerStructuredTextParser)
func (Instance) SetStructuredTextBidiOverrideOptions ¶
func (Instance) SetTextDirection ¶
func (self Instance) SetTextDirection(value gdclass.ControlTextDirection)
func (Instance) SetVirtualKeyboardEnabled ¶
func (Instance) SetVirtualKeyboardType ¶
func (self Instance) SetVirtualKeyboardType(value gdclass.LineEditVirtualKeyboardType)
func (Instance) ShortcutKeysEnabled ¶
func (Instance) StructuredTextBidiOverride ¶
func (self Instance) StructuredTextBidiOverride() gdclass.TextServerStructuredTextParser
func (Instance) StructuredTextBidiOverrideOptions ¶
func (Instance) TextDirection ¶
func (self Instance) TextDirection() gdclass.ControlTextDirection
func (*Instance) UnsafePointer ¶
func (Instance) VirtualKeyboardEnabled ¶
func (Instance) VirtualKeyboardType ¶
func (self Instance) VirtualKeyboardType() gdclass.LineEditVirtualKeyboardType
type MenuItems ¶
type MenuItems = gdclass.LineEditMenuItems //gd:LineEdit.MenuItems
const ( /*Cuts (copies and clears) the selected text.*/ MenuCut MenuItems = 0 /*Copies the selected text.*/ MenuCopy MenuItems = 1 /*Pastes the clipboard text over the selected text (or at the caret's position). Non-printable escape characters are automatically stripped from the OS clipboard via [method String.strip_escapes].*/ MenuPaste MenuItems = 2 /*Erases the whole [LineEdit] text.*/ MenuClear MenuItems = 3 /*Selects the whole [LineEdit] text.*/ MenuSelectAll MenuItems = 4 /*Undoes the previous action.*/ MenuUndo MenuItems = 5 /*Reverse the last undo action.*/ MenuRedo MenuItems = 6 MenuSubmenuTextDir MenuItems = 7 /*Sets text direction to inherited.*/ MenuDirInherited MenuItems = 8 /*Sets text direction to automatic.*/ MenuDirAuto MenuItems = 9 /*Sets text direction to left-to-right.*/ MenuDirLtr MenuItems = 10 /*Sets text direction to right-to-left.*/ MenuDirRtl MenuItems = 11 /*Toggles control character display.*/ MenuDisplayUcc MenuItems = 12 MenuSubmenuInsertUcc MenuItems = 13 /*Inserts left-to-right mark (LRM) character.*/ MenuInsertLrm MenuItems = 14 /*Inserts right-to-left mark (RLM) character.*/ MenuInsertRlm MenuItems = 15 /*Inserts start of left-to-right embedding (LRE) character.*/ MenuInsertLre MenuItems = 16 /*Inserts start of right-to-left embedding (RLE) character.*/ MenuInsertRle MenuItems = 17 /*Inserts start of left-to-right override (LRO) character.*/ MenuInsertLro MenuItems = 18 /*Inserts start of right-to-left override (RLO) character.*/ MenuInsertRlo MenuItems = 19 /*Inserts pop direction formatting (PDF) character.*/ MenuInsertPdf MenuItems = 20 /*Inserts Arabic letter mark (ALM) character.*/ MenuInsertAlm MenuItems = 21 /*Inserts left-to-right isolate (LRI) character.*/ MenuInsertLri MenuItems = 22 /*Inserts right-to-left isolate (RLI) character.*/ MenuInsertRli MenuItems = 23 /*Inserts first strong isolate (FSI) character.*/ MenuInsertFsi MenuItems = 24 /*Inserts pop direction isolate (PDI) character.*/ MenuInsertPdi MenuItems = 25 /*Inserts zero width joiner (ZWJ) character.*/ MenuInsertZwj MenuItems = 26 /*Inserts zero width non-joiner (ZWNJ) character.*/ MenuInsertZwnj MenuItems = 27 /*Inserts word joiner (WJ) character.*/ MenuInsertWj MenuItems = 28 /*Inserts soft hyphen (SHY) character.*/ MenuInsertShy MenuItems = 29 /*Represents the size of the [enum MenuItems] enum.*/ MenuMax MenuItems = 30 )
type VirtualKeyboardType ¶
type VirtualKeyboardType = gdclass.LineEditVirtualKeyboardType //gd:LineEdit.VirtualKeyboardType
const ( /*Default text virtual keyboard.*/ KeyboardTypeDefault VirtualKeyboardType = 0 /*Multiline virtual keyboard.*/ KeyboardTypeMultiline VirtualKeyboardType = 1 /*Virtual number keypad, useful for PIN entry.*/ KeyboardTypeNumber VirtualKeyboardType = 2 /*Virtual number keypad, useful for entering fractional numbers.*/ KeyboardTypeNumberDecimal VirtualKeyboardType = 3 /*Virtual phone number keypad.*/ KeyboardTypePhone VirtualKeyboardType = 4 /*Virtual keyboard with additional keys to assist with typing email addresses.*/ KeyboardTypeEmailAddress VirtualKeyboardType = 5 /*Virtual keyboard for entering a password. On most platforms, this should disable autocomplete and autocapitalization. [b]Note:[/b] This is not supported on Web. Instead, this behaves identically to [constant KEYBOARD_TYPE_DEFAULT].*/ KeyboardTypePassword VirtualKeyboardType = 6 /*Virtual keyboard with additional keys to assist with typing URLs.*/ KeyboardTypeUrl VirtualKeyboardType = 7 )