AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / Desarrollar una aplicación o un sitio web / Controles, ventanas y páginas / Controles: tipos disponibles / Control Interruptor
  • Overview
  • Using a 5-state image for the cursor
  • Advanced style settings
  • Adding an image via gImage
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Customizing the Switch controls
Overview
The Switch control is a 2-state Check Box control (on/off, true/false, yes/no). WINDEV, WEBDEV and WINDEV Mobile offer many customization options.
Using a 5-state image for the cursor
By default, the cursor is defined by a border ("Cursor border" in the "Style" tab of the control description). For each state (resting, hovering, etc.), this frame can be customized: background color, frame type and color, etc.
It is also possible to use an image to define the cursor:
  1. Open the Switch control description window.
  2. On the "Style" tab, select "Cursor border".
  3. In the "Use" area, select "5-state image". A window is displayed to select the desired image for the cursor border.
    The image must be a 5-state image (or an image set) and not a "single" image.
    Note: If you simply have an image "on its own", it can be automatically converted to 5-state mode using the image editor in WINDEV, WEBDEV and WINDEV Mobile.
  4. Validate.
Advanced style settings
To obtain a very specific style, you can fine-tune the different options available in the "Style" tab of the Switch control description window.
For each value (On/Off), for each state (normal, hover, ...) and for each element (slider frame, cursor frame, cursor label, ...), it is possible to modify the font, the colors, the images, etc... There are many combinations!
For example, you can customize the cursor border by changing its roundness. If the roundness is half the dimensions of the cursor, the latter will be "round".
For example, you can use the option "Caption of internal modes" to modify color of inactive captions (caption #B for the "OFF" value and caption #A for the "ON" value).
WEBDEV - Código Servidor In WEBDEV, the caption options allow you to customize the control even more.
For instance, you can use a different font size for the current value. The "active" value size can be 20 px (while the second caption size is 12 px).
You can use emojis (specific Unicode characters) to obtain a "visual" switch and adapt its color.
Please note: the visual displayed is system-dependent (the same character will not be displayed in exactly the same way on Windows, iOS or Android).
Adding an image via gImage
You can add an image to the caption with gImage to quickly customize the text of the options and keep the same cursor. With this method, however, you must select the color of the images carefully, taking into account the color of the cursor.
To make images visible in all the states, simply swap the images through programming when the user clicks on the control ("Whenever modifying" event). For example:
// Adapt the image displayed in the captions 
IF MySelf THEN
    MySelf[1].Caption = gImage(iMG_Name_Gray) + " Sort by name"
ELSE
    MySelf[1].Caption = gImage(iMG_Name_White) + " Sort by name"
END
Note: all gXXX functions can be used in value labels (gFontBold, gFontUnderlined, ...).
WEBDEV - Código Servidor In WEBDEV, the caption can be customized with the CaptionHTML property. The CaptionHTML property defines an HTML code as caption of the options. For example:
MySelf[1].CaptionHTML = "<img src=" + IMG_DATE_GRAY + ">" + " Sort by date"
Ver también
Versión mínima requerida
  • Versión 24
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 14/03/2025

Señalar un error o enviar una sugerencia | Ayuda local