Understanding toolbars
This is an introduction to toolbars definition.
A toolbar defines action views presented as a set of buttons that can trigger events in an interactive instruction.
This section describes how to define toolbars with XML in files or in programs as
global/default toolbars; it is also possible to define toolbars in forms with the TOOLBAR
section, as
form-specific toolbars.
Toolbar files can be loaded by a program with
the methods ui.Interface.loadToolBar()
(for global/default toolbars) or
ui.Form.loadToolBar()
(to load form-specific toolbars).
The position and overall rendering of toolbar can be defined with presentation style attributes
of Window elements, such as toolBarPosition
. Typical "modal windows"
(windowType="modal"
) do not display toolbars. See
FGLDIR/lib/default.4st, where toolBarPosition
is set to
"none"
for that kind of windows. Toolbar position can also be specified
individually with the position
style attribute for ToolBar elements.
The toolbar items (or buttons) are enabled/disabled based on the ON ACTION
handlers defined by
the current interactive instruction. A toolbar item is bound to an action handler by name. A click
on the toolbar button will execute the user code in the action handler.
Toolbar items can be automatically hidden when inactive, if the AUTOHIDE
attribute is specified for
the item.
Toolbar elements can get a style
attribute in order to use a specific
rendering/decoration following presentation style definitions. Specific decoration can be achieved with the
aspect
and size
toolbar-specific style attributes. For more
details, see toolbar style
attributes.
The DOM tag names are case sensitive; Toolbar
is different from ToolBar
.
When binding to an action, make sure
that you are using the right value in the name
attribute. As ON
ACTION
and COMMAND
generate lowercase identifiers, it is recommended to
use lowercase names.
It is recommended that you define the decoration of toolbar items for common actions with action defaults.
Toolbars can get automatic options with the AUTOITEMS
element, to show action views for all default action views,
running applications list and open window list. For more details, see Automatic action views.