SpinBox
classin packageklyn.gui.windows
public class SpinBox extends Widget:
└ SpinBox

Numeric spin box widget.

value is a signal property, so it can be bound directly to another control without exposing a separate valueChanged event.

spin = SpinBox(value=42, minimum=0, maximum=255)
Binding.watch(spin::value, lambda(value: Object): print(value))
Attributes inherited from Widget: keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Properties
Modifier and Type Member Description
public property maximum
maximum as Int = 100
Highest allowed value.
public property minimum
minimum as Int = 0
Lowest allowed value.
public signal property value
value as Int:
Current value clamped between minimum and maximum.
Properties inherited from Widget: accentColor, backgroundColor, borderColor, bottom, canFocus, cornerRadius, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, right, sizePolicy, styleClass, width, window, x, y
Constructors
Modifier and Type Member Description
public SpinBox
SpinBox(value as Int = 0, minimum as Int = 0, maximum as Int = 100):
Creates a spin box with an initial value and range.
Methods
Modifier and Type Member Description
public adjustValueBy
adjustValueBy(delta as Int) as Void:
Adjusts the value by a signed delta.
public beginEdit
beginEdit() as Void:
Starts manual keyboard edition of the numeric field.
public cancelEdit
cancelEdit() as Void:
Cancels manual edition and keeps the current numeric value.
public clampValue
clampValue(value as Int) as Int:
Clamps a value into the configured range.
public clearEdit
clearEdit() as Boolean:
Clears the manual edit buffer.
public commitEdit
commitEdit() as Void:
Commits the manual edit buffer if it contains a valid integer.
public deleteBackward
deleteBackward() as Boolean:
Deletes the last manually edited character.
public insertText
insertText(text as String) as Boolean:
Inserts keyboard text into the spin box edit buffer.
public override paint
paint(painter as Painter) as Void:
Paints the spin box field and stepper affordance.
public setValue
setValue(value as Int) as Void:
Updates the current value and notifies bindings when it changes.
Methods inherited from Widget: blur, containsPoint, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintOverlay, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds