Switch (스위치) Widget Control
Widget Control (Property · Method · Event) you use to control the Switch widget from a script. To learn what the widget does and how to use it, visit the Switch doc.
The switchID in the examples below is the name (ID) you assigned to the Switch widget on the canvas. In a script, access it as widgetID.member.
Widget Control summary
| Widget Control | Kind | Signature | Description |
|---|---|---|---|
onChanged | Event | onChanged = (value) => { ... } | Runs when the switch state changes |
Property
Not applicable — the Switch widget has no script-only Property. In a script, read and write the value (value) with the common Widget Control below (getProperty / setProperty).
Method
Not applicable — the Switch widget has no dedicated Method. Use the common Widget Control below.
Event
onChanged
Runs when you turn the switch on or off and its state changes.
- Kind: Event
- Handler arguments
value(boolean): the state after the change (truemeans on)
- Returns: None
Example
switchID.onChanged = (value) => {
// value: the new switch state (true = on)
};
Common Widget Control (all widgets)
Every widget also supports common Widget Control (Method) such as setProperty(name, value) / getProperty(name) / setStyleProperty(styleName, styleProperty, value). For the detailed rules, see the common Widget Control reference.