TextBox
classin packageklyn.gui.windows
public class TextBox extends 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 const ECHO_NORMAL
ECHO_NORMAL as String = "normal"
Displays the field content as plain text.
public const ECHO_PASSWORD
ECHO_PASSWORD as String = "password"
Masks the field content with bullets while keeping the real value in text.
Properties
Modifier and Type Member Description
public property caretPosition
caretPosition as Long
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 Long
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 Long
Selection active edge.
public property selectionStart
selectionStart as Long
Selection anchor.
public property textAlign
textAlign as String
Horizontal text alignment.
Inherited Properties
propertyInherited Properties from Widget: accentColor, acceptFileDrops, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isPressed, 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
eventInherited Events from Widget: filesDropped, focusGained, focusLost, 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 override applyThemeMetrics
applyThemeMetrics(fontPixelSize as Int, paddingLeft as Int, paddingTop as Int, paddingRight as Int, paddingBottom as Int) as Void
No summary.
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 Long, end as Long = -1) as Void
Updates the current selection range.
public selectAll
selectAll() as Void
Selects the whole field content.
public setCaret
setCaret(position as Long) as Void
Moves the caret to a given position.
Inherited Methods
methodInherited Methods from Widget: applyThemeMetrics, blur, containsPoint, emitFilesDropped, emitFocusGained, emitFocusLost, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintForeground, paintOverlay, preferredSizeIncludesContentZoom, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds