Tutorial Chapter 5: Enhancing the Form |
A topmenu presents a pull-down menu on a form, composed of actions defined by the current interactive BDL instruction in your program.
The same options that were displayed to the user as a toolbar can also be defined as buttons on a pull-down menu ( a topmenu). To change the presentation of the menu options to the user, simply modify and recompile the form specification file.
Figure 1. A form with a topmenu displayed on a Windows™ platform
The TOPMENU section of the form specification allows you to design the pull-down menu. The TOPMENU section must appear after SCHEMA, and must contain a tree of GROUP elements that define the pull-down menu. The GROUP TEXT value is the title for the pull-down menu group.
A GROUP can contain the following elements:
Values can be assigned to attributes such as TEXT, COMMENT, and IMAGE for each item in the TOPMENU.
As in a toolbar, the TOPMENU commands are enabled by actions defined by the current interactive BDL instruction (dialog), which in our example is the MENU statement in the custquery.4gl module. When a TOPMENU option is selected by the user, the program triggers the action to which the TOPMENU command is bound.
The example shows a TOPMENU section in the form specification file (custform.per) for Chapter 5.
01 SCHEMA custdemo 02 03 TOPMENU 04 GROUP form (TEXT="Form") 05 COMMAND quit (TEXT="Quit", COMMENT="Exit the program", IMAGE="exit") 06 END 07 GROUP stores (TEXT="Stores") 08 COMMAND find 09 SEPARATOR 13 COMMAND next 14 COMMAND previous 15 END 16END 17 ...
The revised form specification file must be recompiled before it can be used in the program.