EZRanger:
Filter:
Classes | GUI > EZ-GUI

EZRanger : EZGui : Object

A wrapper class for a label, a rangeslider, and numberboxes

Description

EZRanger is wrapper class which creates an (optional) StaticText, and a Slider plus a NumberBox. If the parent is nil, then EZRanger will create its own window. See EZGui more options.

Scrolling and Arrow Keys

EZRanger's number boxs scroll by default, using the step size of the ControlSpec. If the controlSpec's step is set to 0, or is not set, then the stepping and scrolling will be guessed according to the minval and maxval values of the spec on creation of the view. Unlike the step variable of a regular NumberBox, controlSpec.step is also the smallest possible increment for the NumberBoxs. By default, the shift-key modifier will allow you to step by 100x controlSpec.step, while the ctrl-key will give you 10x controlSpec.step. Since the alt-key would give you 0.1 of the minimum step, it is disabled by default, but you can change that by setting numberView.alt_step to any value you like. Accordingly you can customize the other modifiers to fit your needs. See NumberBox and Slider. This also effects the arrow keys for the slider.

Class Methods

EZRanger.new(parent, bounds, label, controlSpec, action, initVal, initAction: false, labelWidth: 60, numberWidth: 45, unitWidth: 0, labelHeight: 20, layout: 'horz', gap, margin)

Arguments:

parent

The parent view or window. If the parent is nil, then EZRanger will create its own Window, and place it conveniently on the screen if the bounds are a Point. If the bounds are a Rect, then the Rect determines the window bounds.

bounds

An instance of Rect or Point. Default value is 160@20.

label

The label. Default value is nil. If nil, then no StaticText is created.

controlSpec

The ControlSpec for scaling the value.

action

A Function called when the value changes. The function is passed the EZRanger instance as its argument.

initVal

An instance of Array [lo, hi]. If nil, then it uses the ControlSpec's default value.

initAction

A Boolean indicating whether the action function should be called when setting the initial value. The default is false.

labelWidth

Number of pixels width for the label. default is 60.

numberWidth

Number of pixels width for the number box. default is 45.

unitWidth

Number of pixels width for the unit label. The default is 0. If 0, then no unitLabel is created.

labelHeight

The default is 20;

layout

\vert, \line2, or \horz. The default is \horz.

gap

A Point. By default, the view tries to get its parent's gap, otherwise it defaults to 2@2. Setting it overrides these.

margin

A Point. This will inset the bounds occupied by the subviews of view.

Discussion:

The contained views can be accessed via the EZRanger instance variables: rangeSlider, hiBox, loBox, unitView, labelView.

Inherited class methods

Instance Methods

Accessing Instance and Class Variables

.unitView

The units label. Only appears if unitWidth was set to > 0.

.controlSpec

.controlSpec = value

An instance of ControlSpec for scaling the values.

.loBox

The lo value NumberBox.

.action

.action = value

From superclass: EZGui

Set/get a Function or FunctionList to be evaluated when the value changes. The first argument will be the EZRanger.

.rangeSlider

The RangeSlider View

.lo

.lo = val

Set/get the low value.

.hi

.hi = val

Set/get the high value

.hiBox

The hi value NumberBox.

.round

.round = value

Rounds the values in the number boxes.

Doing Some Task (optional)

.doAction

Performs the action at the current index and the global action.

.value

.value = vals

Gets/sets the lo and hi values.

Arguments:

vals

An instance of Array [lo, hi].

.valueAction = vals

Sets the value and performs the action at the index value and the global action.

Arguments:

vals

An instance of Array [lo, hi].

Changing Appearance

.setColors(stringBackground, stringColor, sliderColor, numBackground, numStringColor, numNormalColor, numTypingColor, knobColor, background)

Arguments:

stringBackground

An instance of Color. The background of the label and unit views.

stringColor

An instance of Color. The stringColor of the label and unit views.

sliderColor

An instance of Color. The slider background.

numBackground

An instance of Color. The background of the number view.

numStringColor

An instance of Color. The stringColor of the number view.

numNormalColor

An instance of Color. The normalColor of the number view.

numTypingColor

An instance of Color. The typingColor of the number view.

knobColor

An instance of Color. The knobColor of the slider view.

background

An instance of Color. The background of the enclosing view.

.font = font

Set the Font used by all the views.

Arguments:

font

An instance of Font.

Inherited instance methods

Undocumented instance methods

.prSetViewParams

.prSubViewBounds(rect, hasLabel, hasUnit)

.set(label, spec, argAction, initVal, initAction: false)

Examples