From Xojo Documentation
A Switch has an on/off position and is used to choose a preference. When the Switch is on, it appears with a green background.
Below are commonly used events and properties. See the MobileSwitch for the complete list.
ValueChanged - Called when the value for the Switch is changed, either by the user clicking on it or by code changing its Value property.
Enabled - A boolean that indicates if the switch is enabled and can be tapped or disabled and cannot be changed.
Value - A boolean that indicates the state of the Switch. When True, the Switch is on and displays with a green background. When False, the Switch is off.
To turn a switch on, set its value property:
This code in the ValueChanged event handler enables or disables a Text Field depending on whether a Switch is on or off: