PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV Mobile 25 feature!
  • Overview
  • Implementation
  • Dark theme management
  • Testing an application that uses dark theme in the simulator
  • Special case: Do not use dark theme on a window
  • Programming in WLanguage
  • Overview
  • Specific events
  • WLanguage functions
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
The latest versions of mobile OSs allow you to switch applications to a dark theme to reduce battery consumption or to make the device easier to use in a low-light environment.
WINDEV Mobile allows you to use dark theme in your mobile applications. It allows you to:
  • automatically adapt to the device theme settings. The dark theme will automatically be used.
  • force the use of dark theme or light theme by programming.
Implementation

Dark theme management

To manage dark theme in one of your mobile applications:
  1. Open the project description window: on the "Project" pane, in the "Project" group, click "Description".
  2. In the "Style" tab, check "Allow switching to dark theme (automatically or manually via ChangeTheme)".
    Activating dark theme
  3. Validate.
Caution: After using this option, the application must be tested to make sure there are no UI errors.
Remarks:
  • The project is associated with a single skin template. This skin template corresponds to the light theme. Windows are always edited in light theme. The skin template used for the dark theme is BlackStellar.
  • Tip: Use skin template styles if possible. If colors or images are fixed by programming, use the optional events "Application of light/dark theme" to use a specific color according to the theme used.

Testing an application that uses dark theme in the simulator

When dark theme is enabled in a WINDEV Mobile project, the simulator offers an additional option ( ) allowing to switch the application from one theme to another.
Example:
  1. Start the application test:
    Window test with light theme

    The light theme is used by default.
  2. Click the icon to switch to dark mode: Switch to dark theme.
  3. window displayed with dark theme during test.
    Window test with dark theme

Special case: Do not use dark theme on a window

To not apply dark theme on one of the windows of the application:
  1. Open the window description (e.g. "Description", in the popup menu).
  2. In the "Style" tab, check "Do not apply dark theme".
  3. Validate the description window.
Programming in WLanguage

Overview

After enabling dark mode management, WINDEV Mobile proposes:
  • "Application of light/dark theme", a new event to customize the switch to dark mode if necessary.
  • WLanguage functions to find out, modify and retrieve the theme used.

Specific events

When dark theme management is enabled, the event "Application of light/dark theme" becomes available for the project, for windows and internal windows.
The event "Application of light/dark theme" of the project is run in the following cases:
  • When the application starts (after the "Initializing" event of the project).
  • When the theme is changed by programming with ChangeTheme only if the withCodeExecution constant has been specified.
  • When the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
The event "Application of light/dark theme" of the windows is an optional event. This event is run in the following cases:
  • When the window is opened, after the "Global declarations" event and before the initialization events of the window controls.
  • If the window is open when changing the theme by programming with ChangeTheme, only if the withCodeExecution constant has been specified.
  • It the window is open when the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
The event "Application of light/dark theme" of the internal windows is an optional event. This event is run in the following cases:
  • When loading the internal window, after the "Global declarations" event and before the initialization events of the internal window controls.
  • If the internal window is loaded when changing the theme by programming with ChangeTheme, only if the withCodeExecution constant has been specified.
  • It the internal window is loaded when the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
Remark: These events are not run:
  • if the application does not support dark theme.
  • if the window ignores dark theme.

WLanguage functions

The following WLanguage functions are used to manage dark theme:
Versions 25 and later
ChangeTheme
New in version 25
ChangeTheme
ChangeTheme
Is used to change, by programming, the theme (dark or light) used by the mobile application.
Versions 25 and later
GetTheme
New in version 25
GetTheme
GetTheme
Is used to find out the current theme of a mobile application.
Versions 16 and later
SysTheme
New in version 16
SysTheme
SysTheme
Returns the current theme used on the mobile device.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment