The menu bar item is used to create a narrow rectangular region, across the top of a dialog box, that contains multiple pull-down menus. It is really a composite item. The menu bar itself is simply a placeholder for a number of pull-down menus. There are currently three types of pull-down menus: text, option and color picker menus. These pull-down menus are discussed in their own sections.

ss67.jpg

Item list specification

The DialogItemRsc field extent is unused for menu bar items. Menu bars always go at the top of a dialog box and extend across its entire width. It should be set to {0, 0, 0, 0}.

The type field should be MenuBar.

The ID determines the DItem_MenuBarRsc instance to load.

The attributes field is ignored for menu bar items because the menu bar is always enabled and displayed. The individual pull-down menus can be disabled however.

The itemArg field is unused and should usually be set to 0.

The label field is unused and should be set to "".

The auxInfo field is unused and should be set to "".

The following is an example of a menu bar item list specification:

{{0, 0, 0, 0}, MenuBar, MENUBARID_Main, ON, 0, "", ""}

Item resource specification

The menu bar item is defined in a resource file with the following structure:

typedef struct ditem_menubaritemrsc
{
long type;
long ID;
typedef struct ditem_menubarrsc
{
long itemHookId;
long itemHookArg;
#if defined (resource)
DItem_MenuBarItemRsc menuBarItems[];
#else
long nMenus;
DItem_MenuBarItemRsc pulldownMenus[1];
#endif
} DItem_MenuBarRsc;

The only unique field in the DItem_MenuBarRsc structure is the array of DItem_MenuBarItemRsc that is the menu bar item's list of pull-down menus.

The DItem_MenuBarItemRsc structure has the following unique fields. (See "Common item resource fields" for a description of any field not in this table.)

Field Description
type This field is the type of pull-down menu to include in the menu bar item.
id This field is the resource ID of the pull-down menu to include in the menu bar.

The following is an example of a menu bar item resource. This item is the MicroStation Command window menu bar, and is defined in MicroStation's resource file.

{
{
{PulldownMenu, PULLDOWNMENUID_File},
{PulldownMenu, PULLDOWNMENUID_Edit},
{PulldownMenu, PULLDOWNMENUID_Element},
{PulldownMenu, PULLDOWNMENUID_Settings},
{PulldownMenu, PULLDOWNMENUID_View},
{PulldownMenu, PULLDOWNMENUID_Palettes},
{PulldownMenu, PULLDOWNMENUID_User},
{PulldownMenu, PULLDOWNMENUID_Help},
}
};

Item hook function messages

The following messages are sent to item hook functions that are attached to menu bar items:

  DITEM_MESSAGE_CREATE
  DITEM_MESSAGE_DESTROY
  DITEM_MESSAGE_BUTTON

Menu bar item functions

Funtion Description
mdlDialog_menuBarAddAppMenu adds the Applications pulldown menu to the command window menu bar.
mdlDialog_menuBarAddCmdWinMenu adds a pulldown menu to the command window menu bar.
mdlDialog_menuBarAttachMenu adds a pulldown menu to a menu bar.
mdlDialog_menuBarDeleteCmdWinMenu deletes a pulldown menu from the command window menu bar.
mdlDialog_menuBarDeleteAllItems deletes all the subitems from a specified pull-down menu.
mdlDialog_menuBarDeleteItem deletes a subitem from a specified pull-down menu.
mdlDialog_menuBarDeleteAllMenus deletes all the menus from a menu bar.
mdlDialog_menuBarDeleteMenu deletes an entire pull-down menu from a menu bar item.
mdlDialog_menuBarDetachMenu removes a pulldown menu from a menu bar.
mdlDialog_menuBarFind finds a menu bar in a dialog box.
mdlDialog_menuBarFindAppMenu finds the Applications pulldown menu in the command window menu bar.
mdlDialog_menuBarFindMenu finds a pulldown menu in a menu bar.
mdlDialog_menuBarFindItem finds a particular kind of pull-down menu item based on a search ID.
mdlDialog_menuBarGetCmdWinP gets a pointer to a command window menu bar.
mdlDialog_menuBarGetItem gets a pointer to a pull-down menu item.
mdlDialog_menuBarGetMenu gets a pointer to a pull-down menu.
mdlDialog_menuBarGetNItems returns the number of items in a particular pull-down menu.
mdlDialog_menuBarGetNMenus returns the number of pulldown menus in a particular menu bar.
mdlDialog_menuBarGetSelection retrieves information about the menu item that was last selected from a particular menu bar.
mdlDialog_menuBarInsertMenu inserts a pull-down menu into a menu bar.
mdlDialog_menuBarInsMenu inserts a pull-down menu into a menu bar.
mdlDialog_menuBarMenuGetEnabled gets the state (enabled or disabled) of a menu.
mdlDialog_menuBarMenuSetEnabled sets the state (enabled or disabled) of a pull-down menu.
mdlDialog_menuBarMenuGetTitle gets the title of a pull-down menu.
mdlDialog_menuBarMenuSetTitle sets the title of a pull-down menu.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.