listThemes
Lists all available GBC themes.
Syntax
ui.Interface.frontCall("theme", "listThemes",
[], [result])
- result - A string containing a JSON array of the available themes. For each theme, the name, title, and conditions are listed. The conditions are contained within a second JSON array.
Usage
The
listThemes
function returns a JSON array of the themes available to the
running application. The array consists of the name, title and conditions of each available theme.
For example, the function returns the following when run against the out-of-the-box runtime
installation on a desktop machine (line breaks added for
readability):[{"name":"default","title":"Default","conditions":["isDesktop"]},
{"name":"highcontrast","title":"High contrast","conditions":["isDesktop"]}]
Example
main.4gl
IMPORT util
MAIN
DEFINE themes DYNAMIC ARRAY OF RECORD
name STRING,
title STRING
-- conditions DYNAMIC ARRAY OF STRING
END RECORD
DEFINE result string
OPEN WINDOW w WITH FORM "myform"
CALL ui.Interface.frontcall("theme", "setTheme", ["highcontrast"], [])
DISPLAY "highcontrast" to formonly.setTheme
CALL ui.Interface.frontcall("theme", "getCurrentTheme", [], [result])
DISPLAY result to formonly.getCurrentTheme
CALL ui.Interface.frontcall("theme", "listThemes", [], [result])
DISPLAY result to formonly.listThemes
CALL util.JSON.parse(result, themes)
DISPLAY ARRAY themes TO themes.*
MENU
ON ACTION CANCEL
EXIT MENU
ON ACTION CLOSE
EXIT MENU
END MENU
END MAIN
myform.per
LAYOUT
GRID
{
setTheme [setTheme ]
getCurrentTheme [getCurrentTheme ]
listThemes [listThemes ]
<T t >
Name Title
[name |title ]
< >
}
END
END
ATTRIBUTES
EDIT setTheme = formonly.setTheme;
EDIT getCurrentTheme = formonly.getCurrentTheme;
EDIT listThemes = formonly.listThemes;
name = FORMONLY.name;
title = FORMONLY.title;
INSTRUCTIONS
SCREEN RECORD themes(name, title)