Adding a Topmenu
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.
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:
- a
COMMAND
- specifies the action the menu option must be bound to - a
SEPARATOR
- a horizontal line GROUP
children - a subgroup within a group.
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.
Example ( in custform.per)
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
16
END
17
...
- Lines
04
and07
This exampleTOPMENU
will consist of two groups on the menu bar of the form. TheTEXT
displayed on the menu bar for the first group will be Form, and the second group will be Stores. - Line
08
to14
Under the menu bar item Stores, the command-identifier find on line05
will be bound to theMENU
statement actionfind
on line14
in the custmain.4gl file. The wordfind
must be identical (including case) in both theTOPMENU
command and theMENU
statement action. The other command-identifiers are similarly bound.
The revised form specification file must be recompiled before it can be used in the program.