Commands Element

Represents the collection of commands on the VSPackage toolbar. The collection can have up to five subsections, as follows: menus, menu groups, buttons, combos, and bitmaps.

Each subsection child element, for example, <Menu>, is identified by a unique command ID that is a GUID and numeric identifier pair. The GUID identifies the "command set" and is used to group logically related commands. The VSPackage should define its own command set to avoid collisions with command IDs that are defined by other VSPackages.

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

package

A GUID that identifies the VSPackage that provides the commands.

For example, package="guidVsPackage1Pkg".

Child Elements

Element

Description

Menus Element

Defines all the menus that a VSPackage implements.

Groups Element

Contains entries that define the command groups in a VSPackage.

Buttons Element

Groups Button elements.

Bitmaps Element

Groups Bitmap elements.

Combo Element

Defines the commands that appear in a combo box.

Parent Elements

Element

Description

CommandTable Element

Defines all the elements that represent the commands that a VSPackage provides to the IDE. Possible elements are menu items, menus, toolbars, and combo boxes.

Example

The following example shows how to use a Commands Element.

<Commands package="guidMyPackage">
    <Menus>
      <Menu Condition="'%(DEBUG)' != 'true'" 
        guid="cmdSetGuidMyProductCommands" id="menuIDMainMenu" 
        priority="0x0000" type="Menu">
        <Annotation>
          <Documentation>this is an annotation</Documentation>
          <AppInfo>
            <CustomData>
              <CustomSubElement>Some data</CustomSubElement>
            </CustomData>
          </AppInfo>
        </Annotation>
        <CommandFlag>AlwaysCreate</CommandFlag>
        <Strings>
          <ButtonText>MainMenu</ButtonText>
        </Strings>
      </Menu>
  </Menus>
<Commands>

See Also

Concepts

How VSPackages Add User Interface Elements to the IDE

Other Resources

Menus and Toolbars