Adding toolbars, topmenus, and action defaults

The Form class provides methods that apply topmenus, toolbars, and action defaults to a form, to assist you in standardizing forms.

The topmenus, toolbars, or action defaults are defined in external XML resource files having the following extensions:

  • Action Defaults - .4ad
  • Toolbar - .4tb
  • Topmenu - .4tm

Call the methods using the reference to the form object and specify the resource file name. Do not specify a path or file extension in the file name. If the file is not in the current directory and the path is not specified, Genero will search the directories indicated by the DBPATH / FGLRESOURCEPATH environment variable.

  • Action defaults file - default attributes for form items associated with actions; these action defaults are local to the form. See Action defaults in the Genero Business Development Language User Guide for information about the format and contents of the file.
    CALL f1.loadActionDefaults("mydefaults")
  • Toolbar file - contains a toolbar definition to be used with the referenced form object. See Toolbars in the Genero Business Development Language User Guide for information about the format and contents of the file.
    CALL f1.loadToolBar("mytoolbar")
  • Topmenu file - contains a topmenu definition to be used with the referenced form object. See Topmenus in the Genero Business Development Language User Guide for information about the format and contents of the file.
    CALL f1.loadTopMenu("mytopmenu")

Example 4

01 MAIN
02 DEFINE mywin ui.Window,
03         f1    ui.Form 
04 OPEN WINDOW w1 WITH FORM "testform"
05 LET mywin = ui.Window.forName("w1")
06 CALL mywin.setText("test")
07  LET f1 = mywin.getForm()
08  CALL f1.loadTopMenu("mytopmenu")
09 MENU   
10   ON ACTION quit 
11     EXIT MENU
12 END MENU
13 
14 END MAIN
Figure: Display of a topmenu on Windows® platform

This figure is a screenshot that shows a form with a topmenu.