LayoutValueSlider:
Filter:
ddwGUIEnhancements/Classes (extension) | GUI > Views

LayoutValueSlider
ExtensionExtension

Simplified substitute for EZSlider

Description

A paired NumberBox and Slider, with a ControlSpec defining the range.

Essentially, this is a simpler version of EZSlider. The difference is that LayoutValueSlider uses a HLayout to position the views. You can specify the width of the number box; the HLayout sizes the slider automatically.

This means LayoutValueSlider may be used in Qt layouts (with one small trick; see the examples).

Class Methods

.new

Create an instance.

Arguments:

parent

If not embedding the LayoutValueSlider in a layout, give the parent view here. (If using layouts, this should be nil.)

bounds

If not embedding the LayoutValueSlider in a layout, give the desired bounds. (If using layouts, size and position are automatic, so this should be nil.)

initValue

Initial value. Any kind of SimpleNumber.

spec

A ControlSpec specifying the output range.

numberWidth

Number of pixels to allow the number box. It's set using View: -maxWidth; if the LayoutValueSlider is resized to be very small, the number box may be smaller than this.

Returns:

The LayoutValueSlider instance.

Instance Methods

.spec

Get or set the range ControlSpec.

.action

Get or set the action to take when the value changes. The function is passed view, value as argument. The value is already mapped according to the range spec.

.activeValue

Set the value and call the user action.

.value

Get or set the numeric value.

Examples

Second example notes: