Option Pull-down Menu

Option pull-down menus are similar to text pull-down menus, except that they add the capability to include non-text menu items. The currently selected choice is indicated by a right-pointing triangle on the left side of an option menu item. Option pull-down menus can display either text strings or icons, but not both. Option pull-down menus cannot have submenus.

optionp.jpg

Item resource specification

The option pull-down menu item is defined in a resource file with the following structure:

typedef struct ditem_pulldownoptionmenursc
{
long synonymsId;
ULong helpInfo;
ULong helpSource;
long pulldownHookId;
ULong attributes;
#if defined (resource)
char menuTitle[];
char accessStr[];
DItem_PulldownOptionItemRsc pulldownOptionItems[];
#else
long menuTitleLength;
char menuTitle[1];
#endif
} DItem_PulldownOptionMenuRsc;

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

Field Description
attributes Specifies the attributes of the option pull-down menu. This field will normally be ON | ALIGN_LEFT and is constructed by combining the constants from the attributes table (below) with the logical OR operator.
menuTitle Contains the title of the menu. It should be set to "" if the option pull-down menu is a submenu. (In this case, its title cannot display).
Put a `~' before the character in the title that will be the mnemonic. The mnemonic is the key the user presses to display the menu when navigating the menu bar with the keyboard.
pulldownOptionItems Represents an array of DItem_PulldownOptionItemRsc. This structure is the same as the DItem_OptionButtonItemRsc structure. See the description of the option button item for more information on the fields of this structure.

The following table lists possible values for the attributes field (described above) and the meaning of those values:

attributes Value Meaning
ON The option pull-down menu will be initially enabled.
OFF All subitems in the option pull-down menu will be disabled (dimmed). The title of the menu will also be dimmed (if the pull-down menu is not a submenu).
ALIGN_LEFT This attribute is ignored for submenus. The pull-down menu will be aligned on the left side of the menu bar.
ALIGN_RIGHT This attribute is ignored for submenus. The pull-down menu will be aligned on the right side of the menu bar. By convention, only a Help menu should be right aligned.

The following is an example of an option pull-down menu resource. This item is the MicroStation Command window Element Style submenu, and is defined in MicroStation's resource file.

{
HOOKITEMID_StylePulldown_CmdWindow, ON | ALIGN_LEFT,
"~Line Style", "",
{
{Icon, ICONID_LineStyle0, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~0"},
{Icon, ICONID_LineStyle1, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~1"},
{Icon, ICONID_LineStyle2, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~2"},
{Icon, ICONID_LineStyle3, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~3"},
{Icon, ICONID_LineStyle4, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~4"},
{Icon, ICONID_LineStyle5, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~5"},
{Icon, ICONID_LineStyle6, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~6"},
{Icon, ICONID_LineStyle7, CMD_ACTIVE_STYLE_CSELECT, MCMD, 0, NOMASK,
ON, "~7"},
{Icon, ICONID_LineStyleCustom, CMD_DIALOG_LSTYLESETUP, MCMD, 0, NOMASK,
ON, "~c"},
{Icon, ICONID_LineStyleEdit, CMD_DIALOG_LSTYLEEDIT, MCMD, 0, NOMASK,
ON, "~e"},
}
};

Item hook function messages

The following messages are sent to item hook functions that are attached to option pull-down menus:

  DITEM_MESSAGE_CREATE
  DITEM_MESSAGE_DESTROY
  DITEM_MESSAGE_BUTTON
  DITEM_MESSAGE_GETSTATE
  DITEM_MESSAGE_SETSTATE
  DITEM_MESSAGE_STATECHANGED
  DITEM_MESSAGE_QUEUECOMMAND

Option pull-down menu functions

Funtion Description
mdlDialog_optionPDMItemGetInfo retrieves detailed information about a particular menu item in an option pull-down menu.
mdlDialog_optionPDMItemSetInfo sets various aspects of a menu item in an option pull-down menu.
mdlDialog_optionPDMItemInsert inserts a menu item in an option pull-down menu.
mdlDialog_optionPDMItemSetEnabled changes an option pull-down menu item's state (enabled or disabled).

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