MultiSliderView:
Filter:
Classes | GUI > Views

MultiSliderView

A view displaying an array of sliders
Location: NOT INSTALLED!

Description

MultiSliderView displays a collection of values, each represented by the position of one of the sliders placed side by side.

When clicking into the view, the value of the slider under the mouse pointer will be set. Whenever the mouse is moved with a mouse button pressed, the slider currently under the mouse pointer will be adjusted.

The last slider modified is considered to be the current one, i.e. the -index method will return its index, and -currentValue relates to its value.

The current slider is also considered to be the selected one. Selection can be extended to more than one slider by modifying -selectionSize. Whenever a different slider becomes the current one, the selection size shrinks back to 1. Note that the selection will only be visually indicated if -showIndex is true.

Class Methods

.new

A new MultiSliderView is created empty, without any columns. -size or -value has to be set in order to create some columns.

So if you want a specific number of sliders, then it is best to specify the -size and set -elasticMode to 1. Then you will get a MultiSliderView which distributes -size amount of sliders over bounds.width, where the slider widths are at maximum -indexThumbSize (default 12) and the -gap is adjusted accordingly.

Inherited class methods

Instance Methods

Data

.size

The amount of sliders.

When setting -size, if the new amount is larger then the current, new sliders will be added with the value of 0. In the opposite case, the value of sliders up to the new amount will be preserved, and the rest of the sliders will be removed.

NOTE: In Cocoa GUI:

Changing -size after the view has been drawn or after the -value array has been set will lead to unexpected results. Instead, you should change the -value, if you need to change the contents of the view.

Arguments:

An Integer.

.value

Sets the values of the sliders to those of the elements of the argument.

NOTE: If the amount of elements in the argument does not match -size, then makes -size match before applying the new values.

Arguments:

An array of Floats.

.valueAction

Sets -value and triggers -action.

.reference

The reference values in relation to which the values will be visually represented. The default for each slider is 0.

Arguments:

An array of Floats.

.index

The index of the current slider, i.e. the first one in the selection.

Arguments:

An Integer.

.selectionSize

The amount of sliders in the selection (starting at -index).

.currentvalue

The value of the slider at -index

Arguments:

A Float.

Display

.indexIsHorizontal

The orientation of the view: if true, the sliders are displayed in a horizontal order, otherwise in a vertical order.

Arguments:

A Boolean.

.elasticMode

If enabled (set to 1), the sliders from -startIndex to the last one will be distributed so as to occupy the whole area of the view. The -gap variable will be ignored. The size of each slider in the direction of index will be maximally -indexThumbSize, or smaller in order for all the sliders to fit into the view.

Arguments:

0 (disabled) or 1 (enabled).

.gap

The gap between the sliders in pixels when -elasticMode is disabled.

Arguments:

An Integer.

.indexThumbSize

The size of the sliders in the direction of index in pixels . If -elasticMode is enabled, this will be the maximum size, but the actual size might be smaller in order for all the sliders to fit into the view.

Arguments:

An Integer.

.valueThumbSize

The size of the slider handles in the direction of value in pixels (if drawn).

Arguments:

An Integer.

.thumbSize

Sets both -indexThumbSize and -valueThumbSize to the argument.

.startIndex

The index of the slider displayed at the left or top edge of the view (depending on whether -indexIsHorizontal is true or false, respectively). Sliders with lower index than this will not be visible.

Arguments:

An Integer.

Appearance

.showIndex

Whether the slider selection is visually indicated.

Arguments:

A Boolean.

.drawRects

Whether to draw the sliders.

Arguments:

A Boolean.

.drawLines

Whether to draw a line connecting the points that represent the values of the sliders, and a line connecting the points that represent the references.

Arguments:

A Boolean.

.isFilled

If true, the sliders will have their area between the -reference and the -value colored, and the area bounded by the lines connecting the reference and the value points will be colored as well.

Arguments:

A Boolean.

.strokeColor

The color used to draw the lines described in -drawLines.

Arguments:

A Color.

.fillColor

The color used to visualize the areas described in -isFilled.

Arguments:

A Color.

.colors

Sets -strokeColor and -fillColor to the two arguments, respectively.

Interaction

.editable

Whether the values can be edited using mouse or keyboard.

Arguments:

A Boolean.

.readOnly

The opposite if -editable.

Arguments:

A Boolean.

.step

If the argument is larger than 0, makes the MultiSliderView keep the values quantized to the nearest multiple of the argument.

Actions

.action

The action object evaluated whenever the user changes the value of a slider.

.metaAction

The action object evaluated whenever the user changes the value of a slider while the Ctrl key is pressed.

.defaultKeyDownAction

Implements the default effects of key presses as follows:

KeyEffect
up arrowincrement -currentValue by -step
down arrowdecrement -currentValue by -step
right arrowincrement -index by 1
left arrowdecrement -index by 1

Drag and drop

.defaultGetDrag

Returns:

a) If -selectionSize is 0, returns -value.

b) If -selectionSize > 1, returns an Array with the values at the indexes in the selection.

If -reference is not nil, returns an Array containing (a) or (b), and an Array of the corresponding reference values: [[values], [references]].

.defaultCanReceiveDrag

Returns:

True for any drag data, but the data should either be an Array of values ( [values] ), or an Array containg an Array of values and an Array of corresponding reference values ( [[values], [references]] ).

.defaultReceiveDrag

If the drag data is in one of the acceptable forms (see -defaultCanReceiveDrag above), sets -value (and -reference) using that data.

Inherited instance methods

Examples

Basic Examples

Looks like a candlestick graph:

Interactive Example

A walk through all the graphic options:

Display a Sound File

Use as a Sequencer