PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV, WINDEV Mobile 24 feature!
  • Overview of the Switch control
  • Creating a Switch control
  • Characteristics of the Switch control
  • "General" tab
  • "Style" tab
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview of the Switch control
Switch controls (also called "Toggle controls") are now commonly used in interfaces.
The Switch control is a 2-state Check Box control (on/off, true/false, yes/no). However, instead of checking a box, the user switches the cursor from right to left (and vice versa) to change the state:
  • the cursor moves when the control is clicked on.
  • the cursor can be moved using the mouse.
On touch screens (smartphones, etc.), the control reacts in a natural way (touch slide).
Examples of Switch controls in both possible positions
Examples of Switch controls in both possible positions
Creating a Switch control
To create a Switch control:
  1. On the "Creation" pane, in the "Usual controls" group, expand "Check Box".
  2. The list of available controls (with their preview in the skin template of project) is displayed:
  3. Select the desired Switch control.
  4. Click the position where the control will be created in the window or page. The control appears in creation mode.
To display the control characteristics, select "Description" from the popup menu of control.
Characteristics of the Switch control
The description window of the Switch control is used to easily modify its characteristics:
  • The "General" tab is used to define the control display mode, etc.
  • The "Style" tab is used to customize the look of different elements in the Switch control.

"General" tab

The "General"' tab offers the following options:
  • Display mode: Allows you to define if the captions of control options will be displayed, and where they will be displayed.
    • presence of a caption:
      • if only one caption is visible: the caption is uncovered depending on whether you switch to the right or left.
      • if both captions are visible: the caption that represents the current state is highlighted through its style (font, color, size, etc.).
    • position of the caption(s):
      • internal: the caption is displayed inside the control, on the background.
      • external: the caption is displayed outside the control (right and/or left).
  • Caption alignment: Allows you to align the option captions. This option depends on the display mode chosen.
The "General" tab also allows you to enter the caption of the "ON" and "OFF" options and the corresponding value returned to the program. This value will be handled in the WLanguage code. By default, this value corresponds to 0 for the OFF value, and to 1 for the ON value (like a boolean). It is possible to return a value composed of numbers and/or letters. In this case, ..Value will not return the value as a boolean, but as a text value.
The option "Forces the cursor width to take up half of the track" allows you to use half the width of the control to draw the Switch control when the caption is outside. This option is not valid if the captions are inside the control, on the background.

"Style" tab

The "Style" tab allows you to customize the style of the Switch control. You can customize: the ON and/or the OFF value for each control state.
In each case, different elements of the control can be customized: border of the track, border of the cursor, etc.
see Customizing the Switch controls for more details.
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment