ui.Interface.loadStyles()

ui.Interface.loadStyles() is used to apply user themes to applications at runtime.

Syntax

ui.Interface.loadStyles("theme_file_name")

Parameters

theme_file_name

identifies the necessary theme file (STRING) by its name without extension

When you specify a file name, be careful with its case.

UNIX is case-sensitive, so it will treat files which names come in different cases as separate files.

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

CALLapply_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 sea green 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

master theme -

hello_program.qxtheme

user theme -

my_theme.qxtheme

runtime appearance

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.