SliderFieldView

A numeric input field with an integrated slider for intuitive value adjustment.

SliderFieldView combines a text input field with a horizontal slider, allowing users to either type values directly or drag the slider handle. The component supports numeric ranges, rounding precision, and can be disabled. The slider provides visual feedback and makes it easy to explore value ranges.

Key features:

  • Text input with numeric validation
  • Integrated horizontal slider with draggable handle
  • Configurable min/max value ranges
  • Precision rounding support
  • Keyboard focus and tab navigation
  • Optional text input disabling (slider-only mode)
  • Visual feedback for hover, focus, and disabled states

Usage example:

var slider = new SliderFieldView(0, 100); // min: 0, max: 100
slider.value = 50;
slider.round = 1; // round to integers
slider.enabledTextInput = true;
slider.onValueChange(this, (value, prev) -> {
    trace('Value changed to: ' + value);
});
add(slider);

Instance Members

elements
theme: Theme

Custom theme override for this slider field. If null, uses the global context theme


elements
value: Float

The current numeric value of the slider


elements
minValue: Float

Minimum allowed value for the slider


elements
maxValue: Float

Maximum allowed value for the slider


elements
enabledTextInput: Bool

Whether the text input portion is enabled for direct typing


elements
inputStyle: Anonymous

Visual style of the field (DEFAULT, OVERLAY, or MINIMAL)


elements
disabled: Bool

Whether the entire slider field is disabled and non-interactive


elements
round: Int

Precision for value rounding.

  • -1: No rounding (default)
  • 1: Round to integers
  • 10: Round to tenths (0.1)
  • 100: Round to hundredths (0.01)
  • etc.

elements
invalidateTheme(): Void

elements
invalidateValue(): Void

elements
invalidateMinValue(): Void

elements
invalidateMaxValue(): Void

elements
invalidateEnabledTextInput(): Void

elements
invalidateInputStyle(): Void

elements
invalidateDisabled(): Void

elements
focus(): Void

Handles focus events for the slider field.

When the field gains focus, the text input is also focused for immediate editing.


elements
new(?minValue: Float = 0, ?maxValue: Float = 1): Void

Creates a new SliderFieldView with the specified value range.

Name Type Default Description
minValue Float 0 Minimum value for the slider (default: 0)
maxValue Float 1 Maximum value for the slider (default: 1)

Private Members

elements
unobservedTheme: Theme

elements
unobservedValue: Float

elements
unobservedMinValue: Float

elements
unobservedMaxValue: Float

elements
unobservedEnabledTextInput: Bool

elements
unobservedInputStyle: Anonymous

elements
unobservedDisabled: Bool

elements
sliderContainer: ceramic.View

Container view for the slider track and handle


elements
sliderSquare: ceramic.View

The draggable handle/indicator of the slider


elements
emitThemeChange(current: Theme, previous: Theme): Void

Event when theme field changes.

Name Type
current Theme
previous Theme

elements
emitValueChange(current: Float, previous: Float): Void

Event when value field changes.

Name Type
current Float
previous Float

elements
emitMinValueChange(current: Float, previous: Float): Void

Event when minValue field changes.

Name Type
current Float
previous Float

elements
emitMaxValueChange(current: Float, previous: Float): Void

Event when maxValue field changes.

Name Type
current Float
previous Float

elements
emitEnabledTextInputChange(current: Bool, previous: Bool): Void

Event when enabledTextInput field changes.

Name Type
current Bool
previous Bool

elements
emitInputStyleChange(current: Anonymous, previous: Anonymous): Void

Event when inputStyle field changes.

Name Type
current Anonymous
previous Anonymous

elements
emitDisabledChange(current: Bool, previous: Bool): Void

Event when disabled field changes.

Name Type
current Bool
previous Bool

elements
didLostFocus(): Void

elements
clipText(width: Float, height: Float): Void

Clips the text display to fit within the available text area.

Name Type Description
width Float Available width for text
height Float Available height for text

elements
layout(): Void

elements
layoutSliderContainer(): Void

Positions the slider handle based on the current value.

Calculates the handle position as a proportion of the value within the min/max range, accounting for container padding and handle width.


elements
handleStopEditText(): Void

elements
updateFromValue(): Void

elements
updateStyle(): Void

elements
applyRound(value: Float): Float

Applies rounding to a value based on the round precision setting.

Name Type Description
value Float The value to round
Returns Description
Float The rounded value

elements
handleSliderDown(info: ceramic.TouchInfo): Void

Handles mouse/touch down events on the slider.

Starts slider interaction, sets initial value, and begins tracking pointer movement.

Name Type Description
info ceramic.TouchInfo Touch/mouse interaction information

elements
handleSliderMove(info: ceramic.TouchInfo): Void

Handles pointer movement during slider dragging.

Updates the slider value based on the current pointer position.

Name Type Description
info ceramic.TouchInfo Touch/mouse interaction information

elements
handleSliderUp(info: ceramic.TouchInfo): Void

Handles pointer release events, ending slider interaction.

Removes pointer tracking listeners when slider dragging ends.

Name Type Description
info ceramic.TouchInfo Touch/mouse interaction information

elements
setValueFromSliderX(sliderX: Float): Void

Converts a horizontal slider position to a value within the min/max range.

Calculates the proportional value based on slider position, applies range limits and rounding, then updates the field value.

Name Type Description
sliderX Float Horizontal position within the slider container

Metadata

Name Parameters
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()