TextBox
class in package klyn.gui.windows

    public class TextBox extends Widget:

Widget
└ TextBox

Editable text field.

The class owns a complete single-line editing model: caret position, mouse and keyboard selection, read-only mode, insertion/deletion helpers and the standard `Ctrl+A`, `Ctrl+C`, `Ctrl+X` and `Ctrl+V` shortcuts. Clipboard commands are handled consistently by the Win32 and X11 backends.

    field = TextBox("Hello")
    field.insertText(" world")
    field.selectAll()

Fields

Modifier and Type | Member | Description
--- | --- | ---
public static readonly | ECHO_NORMAL `ECHO_NORMAL as String = "normal"` | Displays the field content as plain text.
public static readonly | ECHO_PASSWORD `ECHO_PASSWORD as String = "password"` | Masks the field content while keeping the real value in `text`.

Properties

Modifier and Type | Member | Description
--- | --- | ---
public property | caretPosition `caretPosition as Int` | Caret insertion position.
public property | echoMode `echoMode as String:` | Controls how the text is rendered.
public property | isReadOnly `isReadOnly as Boolean` | Disables edition while keeping selection and focus support.
public property | maxLength `maxLength as Int` | Maximum accepted characters.
public property | paddingX `paddingX as Int` | Horizontal text padding.
public property | placeholder `placeholder as String` | Placeholder shown when the field is empty.
public readonly property | selectedText `selectedText as String:` | Text currently covered by the selection.
public property | selectionEnd `selectionEnd as Int` | Selection active edge.
public property | selectionStart `selectionStart as Int` | Selection anchor.
public property | textAlign `textAlign as String` | Horizontal text alignment.

Inherited Properties
property Inherited Properties from Widget: accentColor, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, resolvedStyleCache, resolvedStyleCacheAppearanceMode, resolvedStyleCacheFont, resolvedStyleCacheRevision, resolvedStyleCacheStateKey, resolvedStyleCacheStyleClass, resolvedStyleCacheZoomRevision, right, size, sizePolicy, styleClass, toolTip, width, window, x, y
Signals

Modifier and Type | Member | Description
--- | --- | ---
public signal property | text `text as String:` | Current field content.

Inherited Events
event Inherited Events from Widget: keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | TextBox `TextBox(text as String = ""):` | No summary.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | clearSelection `clearSelection() as Void:` | Clears the current selection and keeps the caret at its position.
public | deleteBackward `deleteBackward() as Boolean:` | Deletes the current selection or the character before the caret.
public | deleteForward `deleteForward() as Boolean:` | Deletes the current selection or the character after the caret.
public | hasSelection `hasSelection() as Boolean:` | Returns true when a selection is active.
public | insertText `insertText(value as String) as Boolean:` | Inserts text at the caret position or replaces the current selection.
public | moveCaretLeft `moveCaretLeft(extendSelection as Boolean = false) as Void:` | Moves the caret to the left.
public | moveCaretRight `moveCaretRight(extendSelection as Boolean = false) as Void:` | Moves the caret to the right.
public override | paint `paint(painter as Painter) as Void:` | Paints the field with antialiasing, selection and caret.
public | select `select(start as Int, end as Int = -1) as Void:` | Updates the current selection range.
public | selectAll `selectAll() as Void:` | Selects the whole field content.
public | setCaret `setCaret(position as Int) as Void:` | Moves the caret to a given position.

Inherited Methods
method Inherited Methods from Widget: blur, containsPoint, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintOverlay, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds