skip to main content
OpenEdge Development: ADM and SmartObjects
SmartObjects : SmartToolbars
 
SmartToolbars
A SmartToolbar is an ADM toolbar‑class SmartObject that provides a toolbar and/or menu interface to application commands that perform various actions; for example, running other windows or procedures or performing navigation and transaction actions in the current object. You can contain a SmartToolbar in a SmartWindow but not in a SmartFrame or a SmartDialog, and you can put only one SmartToolbar instance in a given SmartWindow.
When a SmartToolbar instance opens, it contains a default menu and toolbar that provide access to the basic actions that application users perform. You can modify several aspects of the SmartToolbar at design time through its instance properties dialog box: whether to use both the menu and toolbar or only one of them, which actions to include, and selected presentation and behavior details. (For a note on more complex modifications, see the “SmartToolbar usage notes” section.)
The rules and data for the actions accessible in the SmartToolbar are defined in an action class from which the SmartToolbar inherits and are totally independent of the SmartToolbar’s layout and structure. As a result, all SmartToolbar actions have the same text, image, and interface throughout the application regardless of the SmartToolbar layout.
Table 2–12 lists the SmartDataObject files.
 
Table 2–12: SmartToolbar files 
File type
Filename / SmartLinks
Master file
(Because SmartToolbars are customized at design time, a template is not necessary.)
src/adm2/dyntoolbar.w
Primary include file
src/adm2/toolbar.i
ADM/Progress Advisor‑supported SmartLinks
Navigation-Source
TableIO-Source
Note: These links are supported by default. The SmartToolbar also can support the Commit-Source SmartLink depending on how you set the Commit instance property.
Instance properties dialog
src/adm2/support/toold.w (source code)
gui/adm2/support/toold.r (compiled code)
SmartToolbar instance properties
Figure 2–12 shows the SmartToolbar instance properties dialog box:
Figure 2–12: SmartToolbar Properties dialog box
The instance properties in this dialog box are grouped into two panes containing, Style and Content. Figure 2–12 shows the default properties; the available properties might change if you add or remove actions from the SmartToolbar or the action class (on which the SmartToolbar is based). You use these instance properties as described in the following sections.
Style pane
You use the instance properties in the Style pane to specify how your SmartToolbar instance provides access to toolbar actions. You can specify a menu bar, a toolbar, or a menu bar and a toolbar. You cannot deselect both the menu bar and the toolbar. The Style pane contains the following items:
*Menu — If checked (the default), this specifies that the SmartToolbar instance provides a menu bar with the two menus (File and Navigation) shown in Figure 2–13.
Figure 2–13: SmartToolbar menus
Figure 2–13 shows how the menus look when all possible commands are enabled. Various commands are present or absent from the menu bar depending on how you set the instance properties in the Contents pane at design time.
*Toolbar — If checked (the default), this specifies that the SmartToolbar instance provides a toolbar, shown in Figure 2–14.
Figure 2–14: SmartToolbar toolbar
Figure 2–14 shows how the toolbar looks when all possible icons are displayed. Various icons are present or absent depending on how you set the instance properties in the Contents pane at design time.
*Show Border — If checked, this adds a graphic border that surrounds the toolbar and divides the icon groups. This property is enabled only if the Toolbar property is checked.
Contents pane
You use the instance properties in the Contents pane to specify the actions that application users can perform from the SmartToolbar. Each property represents several actions (as defined defined by the action class):
*Navigation — If checked (the default), enables navigation actions: first record, previous record, next record, and last record. These actions are accessible from the First, Prev, Next, and Last commands on the Navigation menu and from the third group of icons (the arrow icons) on the toolbar.
*Tableio — If checked (the default), enables TableIO actions: add, update, copy, delete, and save records; reset; and cancel. These actions are accessible from the Add record, Update record, Copy record, Delete record, Save record, Reset, and Cancel commands on the File menu and the first group of icons on the toolbar.
The Save and Update radio buttons associated with the Tableio check box enable slightly different sets of TableIO actions:
*Clicking the Update button includes the File menu’s Update record and the corresponding icon on the toolbar.
*Clicking the Save button omits the Update record command and icon.
*Commit — If checked, this enables commit actions for updateable objects: undo and commit. These actions are accessible from the FileUndo and FileCommit commands and from the second group of icons on the toolbar. The default is unchecked.
Note: This property is enabled only if you link the SmartToolbar as a Commit-Source to a Commit-Target.
*Filter — If checked, this enables calling a SmartFilter that is the SmartToolbar’s Navigation-Target. This functionality is available through the FileFilter command and the last icon on the toolbar. For details, see the “Filter link as pass‑through link” section.
SmartToolbar usage notes
This section discusses special programming considerations for using SmartToolbars.
SmartPanels as toolbars
In previous ADM releases, a common way to provide toolbar‑type functionality in Progress applications was to instance both a Navigation SmartPanel and an Update SmartPanel and use them collectively as a sort of toolbar. If the containing SmartObject is a SmartWindow, this is no longer necessary, as you can now use a SmartToolbar instead.
Complex SmartToolbar modifications
More complex SmartToolbar modifications (for example, the order and structure of icons and menus) involve modifying the SmartToolbar object itself. You manage the layout and availability of actions in a toolbar in the functions initializeMenu( ) and initializeToolbar( ). These functions are not defined in the SmartToolbar super procedure as a default, but they are called from initializeObject and always must exist in the toolbar. Using these functions to customize the SmartToolbar ensures that its structure and layout are defined at the right moment in the initializeObject( ) function.
You can override the default behavior of the SmartToolbar in either a local SmartToolbar master or a local SmartToolbar super procedure:
*Local SmartToolbar master — Create a local SmartToolbar master by copying the master (adm2/dyntoolbar.w), then customize the initializeMenu( ) and initializeToolbar( ) functions as required.
Note that if your application requires two or more versions of a SmartToolbar, you can create local masters for each (the local masters must have different names), then update the .cst files accordingly.
*Local SmartToolbar super procedure — Create a local SmartToolbar super procedure by copying the super procedure (adm2/custom/toolbarcustom.p), then customizing its code as required. The code in adm2/dyntoolbar.w’s initializeMenu( ) and initializeToolbar( ) functions calls SUPER( ) with the no-error option. If it does not find a super procedure or returns false, the default code is executed.
You can use this technique to implement a data‑driven SmartToolbar that checks properties (for example, user and object) to retrieve the correct SmartToolbar specification data. (If no data is found, return FALSE to trigger the default behavior.)