TextBox
classin packageklyn.gui.windows
public class TextBox extends Widget:
Editable text field.
The class now owns a real text-editing model: caret position, selection,
read-only mode and insertion/deletion helpers. The native backend still has
to relay keyboard and mouse events into this API for the on-screen control
to become interactive.
field = TextBox("Hello")
field.insertText(" world")
field.selectAll()
Properties
| Modifier and Type |
Member |
Description |
| public property |
caretPosition |
Caret insertion position. |
| public property |
isReadOnly |
Disables edition while keeping selection and focus support. |
| public property |
maxLength |
Maximum accepted characters. |
| public property |
paddingX |
Horizontal text padding. |
| public property |
placeholder |
Placeholder shown when the field is empty. |
| public property |
selectionEnd |
Selection active edge. |
| public property |
selectionStart |
Selection anchor. |
| public property |
text |
Current field content. |
Properties inherited from Widget: accentColor,
backgroundColor,
borderColor,
bottom,
canFocus,
cornerRadius,
font,
foregroundColor,
hasFocus,
height,
isEnabled,
isHovered,
isManaged,
isVisible,
layoutParams,
margin,
maxHeight,
maxWidth,
minHeight,
minWidth,
parent,
preferredHeight,
preferredWidth,
right,
styleClass,
width,
window,
x,
y
Constructors
| Modifier and Type |
Member |
Description |
| public |
TextBox |
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 |
Deletes the current selection or the character before the caret. |
| public |
deleteForward |
Deletes the current selection or the character after the caret. |
| public |
hasSelection |
Returns true when a selection is active. |
| public |
insertText |
Inserts text at the caret position or replaces the current selection. |
| public |
moveCaretLeftmoveCaretLeft(extendSelection as Boolean = false) as Void: |
Moves the caret to the left. |
| public |
moveCaretRightmoveCaretRight(extendSelection as Boolean = false) as Void: |
Moves the caret to the right. |
| public override |
paint |
Paints the field with antialiasing, selection and caret. |
| public |
selectselect(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 |
setCaretsetCaret(position as Int) as Void: |
Moves the caret to a given position. |