Command Bar Controls

Initially, one of the most confusing aspects of the Office menu system is that the items that appear on a menu bar are not menus, or even names of menus. Rather, they are controls of type CommandBarControl. Command-bar controls can be added to a menu bar, toolbar, menu, submenu, or shortcut menu. (Think of toolbars, menu bars, and so on as "forms" upon which you place controls.)

Every command-bar control is an object of type CommandBarControl and so it belongs to the CommandBarControls collection. (We are not saying that the Type property of a command-bar control is CommandBarControl.) In addition, every command-bar control is an object of one of the following three object types:

• CommandBarButton

• CommandBarComboBox

• CommandBarPopup

This dual identity of CommandBarControl objects allows the various types of command-bar controls to possess on the one hand a common set of properties and methods (those of the CommandBarControl object) and, on the other hand, an additional set of properties and methods that reflects the diversity of these controls. This makes sense, since, for instance, text boxes are quite different from popup controls. Moreover, as we will see, CommandBarPopup objects need a special property (called Controls) that provides access to the associated menu's controls. (The other types of CommandBarControl objects do not need, and do not have, this property.)

The Type property of a CommandBarControl helps to identify the data type of the control. It can assume any of the values in the following enum:

Enum MsoCont msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro msoContro End Enum rolType lCustom = 0 lButton = 1 lEdit = 2 lDropdown = lComboBox =

lButtonDropdown = 5 lSplitDropdown = 6 lOCXDropdown = 7 lGenericDropdown = 8 lGraphicDropdown = 9 lPopup = 10 lGraphicPopup = 11 lButtonPopup = 12 lSplitButtonPopup = 13 lSplitButtonMRUPopup = 14 lLabel = 15 lExpandingGrid = 16 lSplitExpandingGrid = 17 lGrid = 18 lGauge = 19 lGraphicCombo = 20

CommandBarButton

CommandBarComboBox

CommandBarComboBox

CommandBarComboBox

CommandBarComboBox

CommandBarComboBox

CommandBarComboBox

CommandBarComboBox

CommandBarPopup

CommandBarPopup

CommandBarPopup

CommandBarPopup

CommandBarPopup

CommandBarComboBox

The comments that follow some of the constants in this enum indicate the data type of the control. This information comes from the Microsoft help files. The missing comments mean either that some command-bar controls do not belong to one of the three data types in question or else that the help file has not kept up with later additions to the enum.

0 0

Post a comment