Skip to content

Using Menus, Toolbars and Statusbars

Commandbar Systems

The “commandbar system” is a series of objects that creates a menubar, toolbar, statusbar, and context menu environment. The underlying technology for the commandbar system is Codejock Software’s COM Xtreme CommandBars package. These COM classes have been imported using the DataFlex Import Active/x functionality. An additional layer of classes was created to wrap the imported COM classes. This was done to meet the following objectives:

  • To better integrate the commandbar system into the DataFlex Framework, object model, and style of development.
  • To support visual modeling of menus, toolbars, context menus, and statusbars within the Studio.
  • To simplify usage. The most commonly used features have been exposed and, as needed, expanded to make development easier and faster.
  • To maintain full support for all of the low-level COM features provided with the Codejock product.

The cCJCommandBarSystem class is used to create a commandbar system. A commandbar system consists of a combination of a menubar, any number of toolbars, a statusbar, and any number of context menus. The commandbar system manages all of these components to ensure that they act and behave in a consistent manner. With the exception of context menus, all other commandbar system components will be nested within the commandbar system.

Menubars, toolbars, and context menus all contain “menu item” objects. These are all based on the same class and they can be used interchangeably within menubars, toolbars, and context menus. Statusbars contain statusbar pane objects.

Commandbar System Classes

The commandbar system classes are:

  • cCJCommandBarSystem - This controls the commandbar system.
  • cCJMenuBar - This represents the menubar, normally located at the top of your panel. One menubar is permitted per commandbar system.
  • cCJToolbar - This is used to create toolbars. Multiple toolbars are allowed.
  • cCJContextMenu - This is used to create context menus.
  • cCJMenuItem - This is used to create the items within menubars, toolbars, and context menus. There are two types of menu items: buttons and popups. Buttons are used for making menu selections such as Save or Exit. Popups are used to pop up a menu of additional menu items. Popup menu items will contain child cCJMenuItem objects. A menu item’s control type (popup, non-popup, button, combo, etc.) is determined by a property.
  • cCJStatusbar - This is used to create the status bar that appears at the bottom of your frame.
  • cCJStatusbarPane - This is used to create pane objects within a statusbar object.
  • cCJDesignerMenu - This is used to contain menu items that can be used by the end user to create custom menus.

Object Structures

A typical object structure of a commandbar system is:

Object oCommandBar is a cCJCommandBarSystem
    Object oMenuBar is a cCJMenuBar
        {cCJMenuItem objects…}
    End_Object
    Object oToolBar_1 is a cCJToolbar
        {cCJMenuItem objects…}
    End_Object
    :
    Object oToolBar_n is a cCJToolbar
        {cCJMenuItem objects…}
    End_Object
    Object oStatusBar is a cCJStatusBar
        {cCJStatusbarPane objects…}
    End_Object
    Object oDesignerMenu is a cCJDesignerMenu
        {cCJMenuItem objects…}
    End_Object
End_Object

Object oContextMenu_1 is a cCJContextMenu
    {cCJMenuItem objects…}
End_Object
:
Object oContextMenu_n is a cCJContextMenu
    {cCJMenuItem objects…}
End_Object

Context menus will normally not be placed inside of the commandbar system; they can be placed anywhere else. They will usually be defined near or inside the object that uses it, or out at the desktop level so that all objects may use it.

The {cCJMenuItem objects…} are sets of sibling cCJMenuItem objects. If a cCJMenuItem object is a popup item, it will contain its own set of object {cCJMenuItem objects…}.

The {cCJStatusbarPane objects…} are sets of sibling cCJStatusbarPane objects.

Commandbar System Object

Object oCommandBarSystem is a cCJCommandBarSystem
    Object oMenuBar is a cCJMenuBar
    :
    End_Object
    Object oFindToolBar is a cCJToolbar
    :
    End_Object
    Object oFileToolBar is a cCJToolbar
    :
    End_Object
    Object oEditToolBar is a cCJToolbar
    :
    End_Object
    Object oStatusBar is a cCJStatusBar
    :
    End_Object
    Object oDesignerMenu is a cCJDesignerMenu
    :
    End_Object
End_Object

Expanded Menubar Branch

Object oMenuBar is a cCJMenuBar
    Object oFileMenu is a cCJMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&File"
    :
    End_Object
    Object oFindMenu is a cCJMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&Find"
    :
    End_Object
    Object oViewMenu is a cCJMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&View"
    :
    End_Object
    Object oReportMenu is a cCJMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&Report"
    :
    End_Object
    Object oNavigateMenu is a cCJMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&Navigate"
    :
    End_Object
    Object oWindowMenu is a cCJMDIWindowsMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&Window"
    :
    End_Object
    Object oHelpMenu is a cCJMenuItem
        Set peControlType to xtpControlPopup
        Set psCaption to "&Help"
    :
    End_Object
End_Object

Expanded “Find” Menubar Branch

In this example, all of the menu item classes are sub-classes of cCJMenuItem.

Object oFindMenu is a cCJMenuItem
    Set peControlType to xtpControlPopup
    Set psCaption to "&Find"
    Object oFindFirstTool is a cCJFindFirstMenuItem
    End_Object
    Object oFindPreviousTool is a cCJFindPreviousMenuItem
    End_Object
    Object oFindMenuTool is a cCJFindMenuItem
    End_Object
    Object oFindNextTool is a cCJFindNextMenuItem
    End_Object
    Object oFindLastTool is a cCJFindLastMenuItem
    End_Object
    Object oPromptToolItem is a cCJPromptMenuItem
        Set pbControlBeginGroup to True
    End_Object
End_Object

Expanded “Find” Toolbar Branch

Note that the same menu items can be used interchangeably in toolbars and popup menus.

Object oFindToolBar is a cCJToolbar
    Set psTitle to "Finding Toolbar"
    Object oFindFirstTool is a cCJFindFirstMenuItem
    End_Object
    Object oFindPreviousTool is a cCJFindPreviousMenuItem
    End_Object
    Object oFindMenuTool is a cCJFindMenuItem
    End_Object
    Object oFindNextTool is a cCJFindNextMenuItem
    End_Object
    Object oFindLastTool is a cCJFindLastMenuItem
    End_Object
    Object oPromptToolItem is a cCJPromptMenuItem
        Set pbControlBeginGroup to True
    End_Object
End_Object

Expanded Statusbar Object

Object oStatusBar is a cCJStatusBar
    Object oStatusIdle is a cCJStatusBarPane
        Set piId to sbpIDIdlePane
        Set pbStyleStretch to True
    End_Object
    Object oStatusView is a cCJStatusBarPane
        Set phoViewPane to Self
        Set pbStyleStretch to True
    End_Object
    Object oStatusCaps is a cCJStatusBarPane
        Set piId to sbpIDCapslock
    End_Object
End_Object

Context Menu Object

Object oEditContextMenu is a cCJContextMenu
    Object oUndoMenuItem is a cCJUndoMenuItem
    End_Object
    Object oCutMenuItem is a cCJCutMenuItem
        Set pbControlBeginGroup to True
    End_Object
    Object oCopyMenuItem is a cCJCopyMenuItem
    End_Object
    Object oPasteMenuItem is a cCJPasteMenuItem
    End_Object
    Object oDeleteItem is a cCJDeleteEditMenuItem
    End_Object
    Object oSelectAllMenuItem is a cCJSelectAllMenuItem
        Set pbControlBeginGroup to True
    End_Object
End_Object

See Also