ui.Interface.loadStyles() is used to apply user themes to applications at runtime.
Syntax:
ui.Interface.loadStyles("theme_file_name")
Arguments:
theme_file_name |
identifies the theme file to be applied (STRING) by its name without extension |
Usage and examples:
ui.Interface.loadStyles() allows applying user-created themes to applications at runtime in order to obtain their unique style and appearance.
Theme files are specified by their name alone (no extension is needed):
CALL ui.Interface.loadStyles("my_theme")
If the theme file cannot be found in the current directory, it will be looked for in the directories specified by the FGLIMAGEPATH environment variable.
ui.Interface.loadStyles() produces the same runtime effect as apply_theme(). Both command given below will change the application appearance to the one specified by a certain my_theme file:
CALL ui.Interface.loadStyles("my_theme")
or
CALL apply_styles("my_theme")
The user-created theme applied through ui.Interface.loadStyles or apply_theme() will prevail over all other themes including the system theme and master themes (the ones incorporated in the 4gl program and sharing its name): If the background color is set to Khaki in the application theme and to SeaGreen in the loaded my_theme theme, window will be sea-green at runtime:
4gl source code |
MAIN OPEN WINDOW Hello AT 5,20 WITH 5 ROWS, 25 COLUMNS DISPLAY "Hello)" AT 2,2 ATTRIBUTE (GREEN, BOLD) CALL fgl_getkey() END MAIN |
MAIN CALL ui.Interface.loadStyles("my_theme") OPEN WINDOW Hello AT 5,20 WITH 5 ROWS, 25 COLUMNS DISPLAY "Hello)" AT 2,2 ATTRIBUTE (GREEN, BOLD) CALL fgl_getkey() END MAIN
|
application theme (hello_program.qxtheme) |
|
|
user-created theme (my_theme.qxtheme) |
|
|
runtime appearance |
Related articles:
Environment variables