Slider
classin packageklyn.gui.windows
public class Slider extends Widget
└ Slider

Integer slider widget.

The native backend forwards pointer presses and drags to setValueFromPoint, so the widget remains implemented in Klyn while only the platform event routing stays native.

slider = Slider(value=50, minimum=0, maximum=100, orientation=Slider.HORIZONTAL)
slider.trackFillColor = Color(59, 142, 208, 1.0)
Binding.watch(slider::value, lambda(value as Object): print(value))
Fields
Modifier and Type Member Description
public const HORIZONTAL
HORIZONTAL as String = "horizontal"
No summary.
public const VERTICAL
VERTICAL as String = "vertical"
No summary.
Properties
Modifier and Type Member Description
public property liveValue
liveValue as Boolean
Whether the current value is displayed next to the thumb during drag.
public property maximum
maximum as Int = 100
Highest allowed value.
public property minimum
minimum as Int = 0
Lowest allowed value.
public property orientation
orientation as String = Slider.HORIZONTAL
Slider orientation: horizontal or vertical.
public property showTicks
showTicks as Boolean
Whether the slider paints graduations along its scale.
public property showValues
showValues as Boolean
Whether numeric values are painted near the ticks.
public property tickInterval
tickInterval as Int
Distance between two tick marks and displayed values.
public property trackFillColor
trackFillColor as Color
Color used for the active track segment between minimum and value.
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 value
value as Int
Current value, clamped between minimum and maximum.
Inherited Events
eventInherited Events from Widget: filesDropped, focusGained, focusLost, keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors
Modifier and Type Member Description
public Slider
Slider(orientation as String, value as Int = 50, minimum as Int = 0, maximum as Int = 100)
Creates a slider with an explicit orientation and optional range.
public Slider
Slider(value as Int = 50, minimum as Int = 0, maximum as Int = 100, orientation as String = Slider.HORIZONTAL)
Creates a slider with an initial value, range, and orientation.
Methods
Modifier and Type Member Description
public adjustValueBy
adjustValueBy(delta as Int) as Void
Adjusts the current value by a signed delta.
public beginDrag
beginDrag() as Void
Native backend hook called when a pointer drag starts on this slider.
public clampValue
clampValue(value as Int) as Int
Clamps a value into the slider range.
public endDrag
endDrag() as Void
Native backend hook called when a pointer drag ends on this slider.
public override paint
paint(painter as Painter) as Void
Paints the slider track, optional scale, optional live value, and thumb.
public override preferredSizeIncludesContentZoom
preferredSizeIncludesContentZoom() as Boolean
No summary.
public override resolvePreferredHeight
resolvePreferredHeight() as Int
Resolved preferred height after applying runtime content zoom.
public override resolvePreferredWidth
resolvePreferredWidth() as Int
Resolved preferred width after applying runtime content zoom.
public setValue
setValue(value as Int) as Void
Sets the value and notifies bindings when it changes.
public setValueFromPoint
setValueFromPoint(x as Int, y as Int) as Void
Updates the value from a window-relative pointer 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