SGUIelement:
Filter:
Classes (extension) | SInstruments

SGUIelement
ExtensionExtension

a value with one or more views
Location: NOT INSTALLED!

Description

This is a value with one or more views attached.

Views like sliders and numberboxes are attached using the -addView method. Optionally one can provide a ControlSpec.

Attached views only redraw when -update is called (e.g. inside a slow running Routine). There is no need to defer these update calls and the actual redrawing will only happen if the value has changed since last call to update.

The -action function you set is independent of the views and will be called directly when the value changes (e.g. incoming data from a sensor at very high rate - the action function will be called each time while any attached views will only redraw when update is called).

Changing the value of a view using mouse or keyboard will call the action function immediately.

Class Methods

Inherited class methods

Instance Methods

.action

a Function. can be called without deferring.

.value

get or set the current value. nothing special. normalised. action is only called if value has changed.

.valueAction

set value and always call action - also on repeated values. useful for button toggles.

.doAction

always call action.

.asView

layout support. only latest (last) view is returned. makes adding views to layouts easier.

.views

an array with all added views.

.addView

add a view as a dependancy. also with a spec. automatically sets up the view action function.

Arguments:

view

some view. not complex ones like RangeSlider. for those use subclasses.

spec

a ControlSpec. if not provided a default one will be created.

.update

call at regular intervals (typically a slow fps AppClock routine). if the value has changed the view will redraw.

Inherited instance methods

Examples