setTheme

Activates a specific GBC theme.

Syntax

ui.Interface.frontCall("theme", "setTheme",
   [name], [])
  • name - The theme to be activated.

Usage

The setTheme function allows the application to specify the theme to use for the application.

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)