Signal1
Signal support.
LineEdit.swift:2424class Signal1
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (53) members.
Types
enum MenuItems
class Signal2
Signal support.
class Signal3
Signal support.
enum VirtualKeyboardType
Type members
Instance members
var alignment: HorizontalAlignment
Text alignment as defined in the
HorizontalAlignment
enum.var caretBlink: Bool
If
true
, makes the caret blink.var caretBlinkInterval: Double
The interval at which the caret blinks (in seconds).
var caretColumn: Int32
The caret’s column position inside the
LineEdit
. When set, the text may scroll to accommodate it.var caretForceDisplayed: Bool
If
true
, theLineEdit
will always show the caret, even if focus is lost.var caretMidGrapheme: Bool
Allow moving caret, selecting and removing the individual composite character components.
var clearButtonEnabled: Bool
If
true
, theLineEdit
will show a clear button iftext
is not empty, which can be used to clear the text quickly.var contextMenuEnabled: Bool
If
true
, the context menu will appear when right-clicked.var deselectOnFocusLossEnabled: Bool
If
true
, the selected text will be deselected when focus is lost.var dragAndDropSelectionEnabled: Bool
If
true
, allow drag and drop of selected text.var drawControlChars: Bool
If
true
, control characters are displayed.var editable: Bool
If
false
, existing text cannot be modified and new text cannot be added.var expandToTextLength: Bool
If
true
, theLineEdit
width will increase to stay longer than thetext
. It will not compress if thetext
is shortened.var flat: Bool
If
true
, theLineEdit
doesn’t display decoration.var language: String
Language code used for line-breaking and text shaping algorithms. If left empty, current locale is used instead.
var maxLength: Int32
Maximum number of characters that can be entered inside the
LineEdit
. If0
, there is no limit.var middleMousePasteEnabled: Bool
If
false
, using middle mouse button to paste clipboard will be disabled.var placeholderText: String
Text shown when the
LineEdit
is empty. It is not theLineEdit
’s default value (seetext
).var rightIcon: Texture2D?
Sets the icon that will appear in the right end of the
LineEdit
if there’s notext
, or always, ifclearButtonEnabled
is set tofalse
.var secret: Bool
If
true
, every character is replaced with the secret character (seesecretCharacter
).var secretCharacter: 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.
var selectAllOnFocus: Bool
If
true
, theLineEdit
will select the whole text when it gains focus.var selectingEnabled: Bool
If
false
, it’s impossible to select the text using mouse nor keyboard.var shortcutKeysEnabled: Bool
If
false
, using shortcuts will be disabled.var structuredTextBidiOverride: TextServer.StructuredTextParser
Set BiDi algorithm override for the structured text.
var structuredTextBidiOverrideOptions: GArray
Set additional options for BiDi override.
var text: String
String value of the
LineEdit
.var textChangeRejected: Signal2
Emitted when appending text that overflows the
maxLength
. The appended text is truncated to fitmaxLength
, and the part that couldn’t fit is passed as therejectedSubstring
argument.var textChanged: Signal1
Emitted when the text changes.
var textDirection: Control.TextDirection
Base text writing direction.
var textSubmitted: Signal3
Emitted when the user presses
enter
on theLineEdit
.var virtualKeyboardEnabled: Bool
If
true
, the native virtual keyboard is shown when focused on platforms that support it.var virtualKeyboardType: LineEdit.VirtualKeyboardType
Specifies the type of virtual keyboard to show.
func clear(
) func deleteCharAtCaret(
) Deletes one character at the caret’s current position (equivalent to pressing [kbd]Delete[/kbd]).
func deleteText(fromColumn: Int32, toColumn: Int32
) Deletes a section of the
text
going from positionfromColumn
totoColumn
. Both parameters should be within the text’s length.func deselect(
) Clears the current selection.
func getMenu(
) -> PopupMenu? Returns the
PopupMenu
of thisLineEdit
. By default, this menu is displayed when right-clicking on theLineEdit
.func getScrollOffset(
) -> Double Returns the scroll offset due to
caretColumn
, as a number of characters.func getSelectedText(
) -> String Returns the text inside the selection.
func getSelectionFromColumn(
) -> Int32 Returns the selection begin column.
func getSelectionToColumn(
) -> Int32 Returns the selection end column.
func hasSelection(
) -> Bool Returns
true
if the user has selected text.func insertTextAtCaret(text: String
) Inserts
text
at the caret. If the resulting value is longer thanmaxLength
, nothing happens.func isMenuVisible(
) -> 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).func select(from: Int32, to: Int32
) Selects characters inside
LineEdit
betweenfrom
andto
. By default,from
is at the beginning andto
at the end.func selectAll(
) Selects the whole
String
.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ newText: String) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)