getCurrentTheme

Gets the active GBC theme.

Syntax

ui.Interface.frontCall("theme", "getCurrentTheme",
   [], [result])
  • result - The name of the active theme.

Usage

The getCurrentTheme function allows the application to ask for and receive the theme that, by default, will be used when displaying 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)