Knob:
Filter:
Classes | GUI > Views

Knob

A rotary controller view
Location: NOT INSTALLED!

Description

Knob displays a value from 0.0 to 1.0 in rotary fashion, and allows to control it with either circular or linear mouse motion.

It also displays the deviation of the value from either 0.0 or 0.5, which you can choose using -centered.

To switch between the mouse interaction modes, use -mode.

The amount by which the value changes at interaction can be fine-tuned using -step, -keystep, -shift_scale, -ctrl_scale, and -alt_scale

Class Methods

.defaultMode

The default -mode for newly created Knobs.

Inherited class methods

Instance Methods

Data

.value

The displayed value.

Arguments:

A Number in the range of 0.0 to 1.0.

.valueAction

Sets the value and triggers -action.

.increment

Increments the value by -keystep multiplied by the argument.

Arguments:

A Number.

.decrement

Decrements the value by -keystep multiplied by the argument.

Arguments:

zoom

A Number.

Interaction

.mode

The way value is controlled with respect to mouse movement after clicking on the view:

Defaults to \round.

Arguments:

One of the symbols listed above.

.keystep

The amount by which the value is incremented/decremented when pressing a relevant key.

Defaults to 0.01;

Arguments:

A Number.

.step

The amount by which the value is incremented/decremented using the mouse in 'horizontal' and 'vertical' modes.

Arguments:

A Number.

.shift_scale

The factor by which -step or -keystep is multiplied when used at mouse or keyboard interaction while the Shift key is pressed.

Arguments:

A Float.

.ctrl_scale

The factor by which -step or -keystep is multiplied when used at mouse or keyboard interaction while the Ctrl key is pressed.

Arguments:

A Float.

.alt_scale

The factor by which -step or -keystep is multiplied when used at mouse or keyboard interaction while the Alt key is pressed.

Arguments:

A Float.

Appearance

.centered

Whether the deviation of value will be displayed in relation to 0.0 or 0.5 (e.g. as in a panning controller);

Arguments:

A Boolean.

.color

The colors used by the Knob to draw the following elements:

Arguments:

An Array of four Colors in the order listed above.

Actions

.action

The action object evaluated whenever the user interacts with the Knob using the mouse or the keyboard.

.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

See also: -keystep, -shift_scale, -ctrl_scale, -alt_scale.

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

Basic Example

Compare Mouse Modes

Centered Mode

Center mode is useful for pan or eq gain control etc.

step

-step only affects the 'horiz' and 'vert' modes:

mouseOverAction

Drag and Drop