Topics List
Design Elements

Switch
Binary Selector: The Switch Control

The switch control, often referred to as a toggle switch, is a binary selector used to turn an option on or off. It provides users with a clear visual indication of the current state, making it ideal for settings where users need to quickly and easily enable or disable a feature. The switch control is commonly used for settings such as enabling/disabling notifications, activating a dark mode theme, or toggling a sound on/off. Its simple yet effective design makes it a popular choice for enhancing user experience and providing intuitive interaction in app interfaces.



You can download the project from the following link:

Class_Rar_0__38.rar

Switch´s Properties


During design mode, you can assign the following properties and events to a Switch:



  • name: The name of the Switch control.

  • Position and Size

    • x: The x-coordinate of the Switch control.

    • y: The y-coordinate of the Switch control.

    • const_anchorX: The anchor point on the x-axis.

    • const_anchorY: The anchor point on the y-axis.

    • const_width: The width of the Switch control.

    • const_height: The height of the Switch control.

    • toBack: Set to true to move the Switch control to the back.

    • toFront: Set to true to move the Switch control to the front.

    • isVisible: Set to true to make the Switch control visible.

    • initialSwitchState: The initial state of the Switch control (true for on, false for off).

    • switch_sheet_PIC: The image for the Switch control.

    • switch_mask_sheet_PIC: The mask image for the Switch control.

  • Functions

    • onPress: The function to execute when the Switch control is pressed.