Widgets
Switch
The switch widget is a toggleable control that allows users to switch between two states (on/off).
The configuration is at gmwSwitch, see gmwSwitchTheme.
You draw a switch with gmw_switch.
The function returns 1 when the switch is toggled to the "on" position and 0 when it's in the "off" position.
Like other widgets, you can also use the animated version
gmw_switch_anim for smooth visual transitions.
Example
Configuration
The switch appearance and behavior can be customized through the gmwSwitch global variable:
Tips
- The switch returns its current state (1 for on, 0 for off)
- Use the animated version for smoother visual transitions
- The fourth parameter controls the size of the switch area
- The switch automatically toggles when clicked
