Back to Contents


The Interface class

Summary:

See also: Built-in classes


Basics

Purpose:

The Interface class is a built-in class provided to manipulate the user interface.

Syntax:

ui.Interface

Notes:

  1. This class does not have to be instantiated.

Methods:

Class Methods
Name Description
frontCall( module STRING, name STRING, parameter-list, returning-list ) Calls the front end function name of the module module.
See Front End Functions for more details.
getDocument()
  
RETURNING om.DomDocument
Returns the DOM document owning the Abstract User Interface tree.
getFrontEndName()
  
RETURNING STRING
Returns the type of the front end ( 'Gdc', 'Console' ).
getFrontEndVersion()
  
RETURNING STRING
Returns the front end version string.
getRootNode()
  
RETURNING om.DomNode
Returns the root DOM node of the Abstract User Interface tree.
loadStartMenu( file STRING ) Loads the start menu defined in an XML file into the AUI tree. See StartMenus for more details.
loadToolBar( file STRING ) Loads the toolbar defined in an XML file into the AUI tree. See Toolbars for more details.
loadTopMenu( file STRING ) Loads the topmenu defined in an XML file into the AUI tree. See TopMenus for more details.
loadActionDefaults( file STRING ) Loads the default decoration for actions from a specific XML file into the AUI tree. See Action Defaults for more details.
loadStyles ( file STRING ) Loads styles defined in an XML file into the AUI tree. See Prensentation Styles for more details.
setName( name STRING ) Sets the name to identify the program on the front-end.
getName()
  
RETURNING STRING
Returns the identifier of the program.
setText( title STRING ) Defines a title for the program.
getText()
  
RETURNING STRING
Returns the title of the program.
setImage( name STRING ) Sets the name of the icon to be used for this program.
getImage()
  
RETURNING STRING
Returns the name of the icon.
setType( type STRING ) Defines the type of program. Values can be 'normal', 'container' or 'child'.
getType()
  
RETURNING STRING
Returns the type of the program.
setContainer( name STRING ) Defines the name of the parent container of this program.
getContainer()
  
RETURNING STRING
Returns the name of the parent container of this program.
getChildCount()
  
RETURNING INTEGER
Returns the number of children in this container.
getChildInstances( name STRING )
  
RETURNING INTEGER
Returns the number of children identified by name.
refresh() Synchronizes the front end with the current AUI tree.

Examples

Example 1: Get the type and version of the front end.

01 MAIN
02   MENU "Test"
03     COMMAND "Get"
04       DISPLAY "Name = " || ui.Interface.getFrontEndName()
05       DISPLAY "Version = " || ui.Interface.getFrontEndVersion()
06     COMMAND "Exit"
07       EXIT MENU
08   END MENU
09 END MAIN

Example 2: Get the AUI root node and save it to a file in XML format.

01 MAIN
02   DEFINE n om.DomNode
03   MENU "Test"
04     COMMAND "SaveUI"
05       LET n = ui.Interface.getRootNode()
06       CALL n.writeXml("auitree.xml")
07     COMMAND "Exit"
08       EXIT MENU
09   END MENU
10 END MAIN

Example 3: Using the Window Container Interface

The WCI parent program:

01 MAIN
02   CALL ui.Interface.setName("main1")
03   CALL ui.Interface.setText("This is the MDI container")
04   CALL ui.Interface.setType("container")
05   CALL ui.Interface.loadStartMenu("appmenu")
06   MENU "Main"
07     COMMAND "Help" CALL help()
08     COMMAND "About" CALL aboutbox()
09     COMMAND "Exit"
10       IF ui.Interface.getChildCount()>0 THEN
11          ERROR "You must first exit the child programs."
12       ELSE
13          EXIT MENU
14       END IF
15   END MENU
16 END MAIN

The WCI child program:

01 MAIN
02   CALL ui.Interface.setName("prog1")
03   CALL ui.Interface.setText("This is module 1")
04   CALL ui.Interface.setType("child")
05   CALL ui.Interface.setContainer("main1")
06   MENU "Test"
07     COMMAND "Exit"
08       EXIT MENU
09   END MENU
10 END MAIN

Example 4: Synchronizing the AUI tree with the front end.

01 MAIN
02   DEFINE cnt INTEGER
03   OPEN WINDOW w WITH FORM "myform"
04   FOR cnt=1 TO 10
05     DISPLAY BY NAME cnt
06     CALL ui.Interface.refresh()
07     SLEEP 1
08   END FOR
09 END MAIN