Skip to main content

InputRange

Wolfram Kernel
Execution environment
Notebook`Kernel`Inputs`
Context
InputRange[min_, max_, step_:1, initial_:(min+max)/2, opts___] _EventObject

creates a basic combo of a slider and numerical input field and returns EventObject

Event generation

Every-time user drags a slider, an event in a form of number will be generated

slider = InputRange[0,1,0.1];
EventHandler[slider, Function[data,
Print[StringTemplate["`` is a number"][data]]
]];
slider
info

On MacOS devices it provides a haptic feedback when dragged

Options

"Label"

Adds a label to a slider

slider = InputRange[0, 1, 0.1, "Label"->"Slider"]

"Topic"

Specifies which topic or pattern of an event is used

"Topic" -> name_String

emits name for each time when user drags a slider

"Topic" -> {oninput_String, onchange_String}

emits oninput when any changes occur, while onchange is emitted after the users action

Applications

Control properties using knob

EventHandler[InputRange[0,1,0.1], Function[data, pos = data]];
%
% // EventFire;
Graphics[Rectangle[{-1,0}, {1, Offload[pos]}]]