Adding a Toolbar
A toolbar presents buttons on the form associated with actions defined by the current interactive BDL instruction in your program.
The TOOLBAR
section of a form specification file defines a toolbar with buttons
that are bound to actions. A toolbar definition can contain the following elements:
- an
ITEM
- specifies the action that is bound to the toolbar button - a
SEPARATOR
- a vertical line
Values can be assigned to TEXT
, COMMENT
, and
IMAGE
attributes for each item in the toolbar.
The toolbar commands are enabled by actions defined by the current interactive BDL instruction,
which in our example is the MENU
statement in the
custquery.4gl module. When a toolbar button is selected by the
user, the program triggers the action to which the toolbar button is bound.
Example: (in custform.per)
The toolbar in this example will display buttons for find
,
next
, previous
, and quit
actions.
01
SCHEMA
custdemo
02
03
TOOLBAR
04
ITEM
find
05
ITEM
previous
06
ITEM
next
07
SEPARATOR
08
ITEM
quit (TEXT
="Quit", COMMENT
="Exit the program", IMAGE
="exit")
09
END
10
...
- Line
04
TheITEM
command-identifierfind
will be bound to theMENU
statement actionfind
on line14
in the custmain.4gl file. The word find must be identical in both theTOOLBAR ITEM
and theMENU
statement action, and must always be in lowercase. The other command-identifiers are similarly bound. - Line
08
Although attributes such asTEXT
orCOMMENT
are defined for theITEM
quit
, the itemsfind
,previous
, andnext
do not have any attributes defined in the form specification file. These actions are common actions that have default attributes defined in the action defaults file.