Defined in Control.Def Inherits from Control
The Switch class provides you with a control that has two states: on and off.
Remember that if the documentation and the software (especially the definition files) disagree, always trust the software.
Class Switch is a direct descendent of class Control. Users toggle switches by tapping on them. The system plays a satisfying click sound, and draws the switch in the opposite state.
Switches can be found in choose one boxes, in the tinker window, and everywhere things can be turned on and off.
Instantiate: often Subclass: sometimes Call its methods: rarely
You'll rarely call any methods of class Switch. Usually, you'll just get switches from the Magic Hat and put them in place with their scripts. The method you will call most often, IsOn, tells you if the switch is on or off.
The Switch class has one method you might call:
Method | Description |
---|---|
IsOn | Returns the switch state |
The Switch class defines no fields itself, but inherits the following fields:
Field | Type | Description |
---|---|---|
Inherited from SingleLinkable: | ||
next | Object | Next item in view list |
Inherited from Linkable: | ||
previous | Object | Previous item in view list |
Inherited from Viewable: | ||
superview | Viewable | Container for this object |
subview | Viewable | Object contained by this object |
relativeOrigin | Dot | Origin relative to superview |
contentSize | Dot | Size of content rectangle |
viewFlags | Unsigned | Property settings |
labelStyle | TextStyle | Text style of object's label |
color | Color | Color of object's content |
shadow | Shadow | Shadow drawn with object |
sound | Sound | Sound associated with object |
Inherited from HasBorder: | ||
border | Border | Frame drawn around control |
Inherited from Control: | ||
image | Image | Image used to draw control |
textStyle | TextStyle | Text style used for control's label |
controlFlags | Unsigned | Various settings for control |
level | Fixed | Current setting of control |
min | Fixed | Minimum setting allowed for control |
max | Fixed | Maximum setting allowed for control |
target | Object | Object watched and controlled by control |
targetAttribute | Unsigned | Selected attribute of watched object |
operation IsOn: Boolean call: sometimesOverride: never
Returns true if the switch is "on", that is, if the current setting of the switch is its maximum setting. Otherwise, returns false.