SWITCH

From SEGGER Wiki
Jump to: navigation, search

A SWITCH widget is a toggleable switch with two states. The widget is similar to the switches seen on most modern smartphones, e.g. in a phone settings application. A SWITCH widget can have two states, a 'left' state when the thumb is on the left and a 'right' state when the thumb is on the right. Optionally, each state has its own text that is shown inside of the switch.

The widget can be clicked to be toggled, or its thumb can be dragged from one side along to the other side, as seen on most smartphones.

SWITCH
SWITCH.png
Receives focus No
Skinnable No
OwnerDraw No
Uses Memory Devices Yes
Attached widgets None

Notification codes

The following events are sent from a SWITCH widget to its parent window as part of a WM_NOTIFY_PARENT message:

Message Description
WM_NOTIFICATION_CLICKED SWITCH has been clicked.
WM_NOTIFICATION_RELEASED SWITCH has been released.
WM_NOTIFICATION_MOVED_OUT SWITCH has been clicked and pointer has been moved out of the SWITCH area without releasing.
WM_NOTIFICATION_VALUE_CHANGED The state of the SWITCH widget has been changed.

Keyboard reaction

The widget can not gain the input focus and does not react on keyboard input.

Samples

Below are links to samples that demonstrate how to use SWITCH widgets in emWin.