ToggleSwitch:
Filter:
Classes (extension) | GUI > Views

ToggleSwitch
ExtensionExtension

A nice little Toggle switch
Location: NOT INSTALLED!

Description

A horizontal or vertical toggle switch with a label

Class Methods

.new

create a new ToggleSwitch.

Arguments:

parent

A parent view.

bounds

A Rect. if width>height, a horizontal switch, otherwise vertical.

label

A label text. For vertical swiches omit or make very short.

toggleSize

The size of the toggle widget (width or height).

label2

An optional second label on the other side of the switch.

radius

a radius size for corners. defualts to \auto .

Returns:

a new ToggleSwitch

.newSquare

a convencienc method to create a ToggleSwitch with no rouding or button inset.

Returns:

a new ToggleSwitch

.defaultOnColor

default:Color.green(0.6);

override individually with onColor

.defaultOffColor

default: Color.grey.alpha_(0.6);

override individually with offColor

Inherited class methods

Instance Methods

All of the setter methods except value and valueAction need you to do myInstance.view.refresh after setting the value;

.value

.valueAction

set the value adm preform the action

.border

.borderColor

.knobInset

.label

.label2

.labelColor

.onColor

.offColor

.borderColor

.radius

.offColor

.font

.labelOffset

.toggleSize

.drawFunc

.drawFrame

.drawKnob

.drawLabel

.drawLabel2

.drawWidget

Inherited instance methods

Customizing

All draw function in the class or separated into drawMyMethod methods.

So you can override the methods to add in icon, e.g., if you like.

EXAMPLES

Execute the code below to test all the features and parameters.