Button element

Defines an element that the user can interact with. Buttons can be of different kinds: Button, MenuButton, and SplitDropDown.

Syntax

<Button guid="guidMyCommandSet" id="MyCommand" priority="0x102" type="button">
  <Parent>... </Parent>
  <Icon>... </Icon>
  <CommandFlag>... </CommandFlag>
  <Strings>... </Strings>
</Button>

Attributes and elements

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

Attributes

Attribute Description
guid Required. GUID of the GUID/ID command identifier.
id Required. ID of the GUID/ID command identifier.
priority Optional. A numeric value that specifies the priority.
type Optional. An enumerated value that specifies the kind of button.

If not given, uses Button.

Button
A standard command that appears on toolbars (typically as an iconic button), menus, and context menus.

MenuButton
A menu item that does not execute a command, but produces another menu.

SplitDropDown
Controls, such as the Undo and Redo buttons on the standard toolbar in Microsoft Word.
Condition Optional. See Conditional attributes.

Child Elements

Element Description
Parent element Optional. The parent element of the button.
Icon element Optional. The icon associated with the button.
Command flag element Required. The valid CommandFlag values for a Button are as follows.

- AllowParams

- CommandWellOnly

- DefaultDisabled

- DefaultInvisible

- DontCache

- DynamicItemStart

- DynamicVisibility

- FixMenuController

- IconAndText

- NoButtonCustomize

- NoCustomize

- NoKeyCustomize

- NoShowOnMenuController

- Pict

- PostExec

- ProfferedCmd

- RouteToDocs

- TextCascadeUseBtn

- TextMenuUseButton

- TextChanges

- TextChangesButton

- TextContextUseButton

- TextMenuCtrlUseMenu

- TextMenuUseButton

- TextOnly
Strings element Required. The child ButtonText element must be defined.
Annotation Optional comment.

Parent elements

Element Description
Buttons element Groups Button elements.

Example

The following example defines a button in a .vsct file.

<Button guid="guidMenuTextCmdSet" id="cmdidMyCommand" priority="0x0100" type="Button">
   <Parent guid="guidMenuTextCmdSet" id="MyMenuGroup" />
   <Icon guid="guidImages" id="bmpPic1" />
   <CommandFlag>TextChanges</CommandFlag>
   <Strings>
         <CommandName>cmdidMyCommand</CommandName>
         <ButtonText>My Command name</ButtonText>
   </Strings>
</Button>

See also