ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / Phone functions
  • Use conditions
  • Operation and special cases
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
ChangeTheme (Function)
In french: ChangeThème
Is used to change, through programming, the theme (dark or light) used by the mobile application.
Example
// When modifying the Check Box control "CBOX_NightMode"
IF CBOX_NightMode THEN
ChangeTheme(stThemeDark)
ELSE
ChangeTheme(stThemeLight)
END
// Initialize project theme using system theme
ChangeTheme(SysTheme())
Syntax
ChangeTheme(<Theme> [, <Option>])
<Theme>: Integer constant
Theme to apply:
stThemeAutomaticDefault theme used by the mobile device. The theme changes automatically according to the system settings.
stThemeDarkForces the use of the dark theme.
stThemeLightForces the use of the light theme.
<Option>: Optional Integer constant
Indicates whether theme change events should be run:
withCodeExecution
(Default value)
All WLanguage events related to the theme application are run in the following order:
  1. Event "Application of light/dark theme" of the project.
  2. Optional event "Application of light/dark theme" of the windows.
  3. Optional event "Application of light/dark theme" of the internal windows.
Remark: If the dark theme cannot be applied to the window (option "Do not apply dark theme" in the "Style" tab of the window description), the event "Application of light/dark theme" is not run in this window, but it is run in all the other open windows and in the project.
withoutCodeExecutionNo WLanguage event (project and/or windows or internal windows) linked to the application of the light/dark theme is run.
Remarks

Use conditions

The dark theme must have been enabled in the application in order to use ChangeTheme:
  1. Open the project description window: on the "Project" tab, in the "Project" group, click "Description".
  2. In the "Style" tab, check "Allow switching to dark theme (automatically or manually via ChangeTheme)".
  3. Validate.
If the dark theme has not been allowed, ChangeTheme returns an error.
For more details, see Dark theme management.

Operation and special cases

  • The automatic mode is used by default.
  • If the selected theme corresponds to the current theme, ChangeTheme has no effect.
  • When ChangeTheme is used, the theme is changed in all the windows of the application (except in those for which the option "Do not apply dark theme" is checked in the "Style" tab of the description window.
  • Windows opened next will use the theme specified with ChangeTheme.
Business / UI classification: UI Code
Component: wd290android.jar
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help