Slider:
Filter:
Classes | GUI > Views

Slider

A view consisting of a sliding handle.
Location: NOT INSTALLED!

Description

A view that allows setting a numerical value by means of moving a sliding handle. It can have horizontal or vertical orientation, meaning the direction in which the handle moves.

Class Methods

.new

When a new Slider is created, its -orientation is determined by the initial size: if it is wider than high, the orientation will be horizontal, otherwise it will be vertical.

Inherited class methods

Instance Methods

Data

.value

Numerical value between 0 and 1, represented by the handle position within the groove.

Arguments:

A Float.

.valueAction

Sets -value and triggers -action.

.increment

Increments the value by -step multiplied by 'factor'.

Arguments:

factor

Any number.

.decrement

Decrements the value by -step multiplied by 'factor'.

Arguments:

factor

Any number.

Appearance

.orientation

The orientation of the Slider - the direction in which the handle moves. The default value depends on the size of the view when created.

Arguments:

One of the two Symbols: \horizontal or \vertical.

.thumbSize

The size of the handle - its width or height, depending on -orientation.

Arguments:

An Integer amount of pixels.

.knobColor

The color of the handle.

Arguments:

A Color.

Interaction

.step

The amount by which the value will changed when -increment or -decrement is called, or when related keys are pressed.

Arguments:

A Float.

.pixelStep

The absolute amount by which the value would change if the handle moved by one pixel.

Returns:

A Float.

.shift_scale

The factor by which -step is multiplied when incrementing or decrementing the value by keyboard while the Shift key is pressed.

Arguments:

A Float.

.ctrl_scale

The factor by which -step is multiplied when incrementing or decrementing the value by keyboard while the Ctrl key is pressed.

Arguments:

A Float.

.alt_scale

The factor by which -step is multiplied when incrementing or decrementing the value by keyboard while the Alt key is pressed.

Arguments:

A Float.

Actions

.action

The action object evaluated whenever the user moves the handle.

.defaultKeyDownAction

Implements the default effects of key presses as follows:

KeyEffect
rvalueAction_(1.0.rand)
nvalueAction_(0)
xvalueAction_(1)
cvalueAction_(0.5)
]increment
[decrement
up arrowincrement
down arrowdecrement
right arrowincrement
left arrowdecrement

Drag and drop

.defaultGetDrag

Returns:

The -value.

.defaultCanReceiveDrag

Returns:

True if the current drag data is a number.

.defaultReceiveDrag

Sets -valueAction to the current drag data.

Inherited instance methods

Examples

Show the slider value in a NumberBox

Use a Spec to round and map the output range

Change the stepsize of the slider, selected via a PopUpMenu

Use the slider view to accept key actions

Adding functionality to a view by the method addAction

This is useful for adding things to existing frameworks that have action functions already.

Use Slider for triggering sounds

Change background color of Window