Using the Interface Class

Methods in the Interface class allow you interact with the user interface, as shown in the examples.

You do not need to get an object reference to the Interface; call the methods in the Interface class using the class identifier, ui.Interface.

Refresh the interface

The User Interface on the Client is synchronized with the DOM tree of the runtime system when an interactive statement is active. If you want to show something on the screen while the program is running in a batch procedure, you must force synchronization with the front end.

As shown in the Tutorial Chapter 9 Reports, the changes made in the program to the value of the progress bar are not displayed on the user's window, since the report is a batch process and no user interaction is required. To force the changes in the progress bar to be reflected on the screen, the following method from the Interface Class is used:
CALL ui.Interface.refresh()

Load custom XML files

  • Start Menus, Toolbar icons, and Topmenus can each be defined in a unique XML file.

Use the appropriate extension:

  • Start Menu - .4sm
  • Toolbar - .4tb
  • Topmenu - .4tm
Use the corresponding method to load the file:
CALL ui.Interface.loadStartMenu("mystartmenu")
CALL ui.Interface.loadTopMenu("tmstandard")
CALL ui.Interface.loadToolbar("tbstandard")

Do not specify a path or file extension in the file name. The runtime system automatically searches for a file with the correct extension in the current directory and in the path list defined in the DBPATH / FGLRESOURCEPATH environment variable.

See the Loading a start menu from an XML file, ui.Interface.loadTopMenu, or ui.Interface.loadToolBar documentation in the Genero Business Development Language User Guide for details on the format and contents of the files.

  • Custom Presentation Styles and global Action Defaults must each be defined in a unique file.

Use the appropriate extension:

  • Presentation Styles - .4st
  • Action Defaults - .4ad

Use the corresponding method to load the file:

CALL ui.Interface.loadStyles("mystyles")
CALL ui.Interface.loadActionDefaults("mydefaults")

You can provide an absolute path with the corresponding extension, or a simple file name without the extension. If you give the simple file name, the runtime system searches for the file in the current directory. If the file does not exist, it searches in the directories defined in the DBPATH/ FGLRESOURCEPATH environment variable.

The action defaults are applied only once, to newly created elements. For example, if you first load a toolbar, then you load a global Action defaults file, the attribute of the toolbar items will not be updated with the last loaded Action defaults.

See Presentation styles and Action defaults files in the Genero Business Development Language User Guide for details on the format and contents of the file.

Identify the Genero client

You can use methods in the Interface Class to identify the type and version of the Genero client currently being used by the program:

CALL ui.Interface.getFrontEndName() RETURNING typestring
CALL ui.Interface.getFrontEndVersion() RETURNING versionstring 

Each method returns a string. The type will be "Gdc" or "Console".

Some of the other methods in the ui.Interface class allow you to:

  • Set and retrieve program names and titles
  • Call Front End functions that reside on the Genero client
  • Work with MDI windows

See the The Interface class documentation in the Genero Business Development Language User Guide for a complete list of the methods.