Command Flag Element

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Command Flag Element.

Modifies its parent element.

<CommandFlag>DynamicVisibility</CommandFlag>  

The following section describes valid element values.

Attributes

None.

Child Elements

ValueDescription
AllowParamsIndicates that users can enter command parameters in the Command window when they type the canonical name of the command.

Valid for: Button
AlwaysCreateMenu is created even if it has no groups or buttons.

Valid for: Menu
CaseSensitiveUser entries are case-sensitive.

Valid for: Combo
CommandWellOnlyApply this flag if the command does not appear on the top-level menu and you want to make it available for additional shell customization, for example, for binding it to a keyboard shortcut. After the VSPackage is installed, you can customize these commands by opening the Options dialog box and then editing the command placement under the Keyboard Environment category. This flag does not affect placement on shortcut menus, toolbars, menu controllers, or submenus.

Valid for: Button, Combo
DefaultDisabledBy default, the command is disabled if the VSPackage that implements it is not loaded or the QueryStatus method has not been called.

Valid for: Button, Combo
DefaultDockedDocked by default. This setting no longer applies to toolbars because they are always docked.
DefaultInvisibleBy default, the command is invisible if the VSPackage that implements it is not loaded or the QueryStatus method has not been called.

We recommend that you combine this with the DynamicVisibility flag.

Valid for: Button, Combo, Menu
DontCacheThe development environment does not cache the QueryStatus method results for this command.

For a menu, this tells a menu controller not to cache the text of its menu items. Use this flag when the menu contains dynamic items or items that have dynamic text.

Valid for: Button, Menu
DynamicItemStartIndicates the beginning of a dynamic list. This enables the environment to build a list by successively calling the QueryStatus method on list items until the OLECMDERR_E_UNSUPPORTED flag is returned. This works well for items such as most recently used (MRU) lists and window lists.

Valid for: Button
DynamicVisibilityThe visibility of the command can be changed through the QueryStatus method or through a context GUID that is included in the VisibilityConstraints section.

Applies to commands that appear on menus and tool window toolbars, but not on top-level toolbars that appear on the main window. Top-level toolbar items can be disabled but not hidden, when the OLECMDF_INVISIBLE flag is returned from the QueryStatus method. Toolbar commands that appear on tool window toolbars can be hidden.

On a menu, this flag also indicates that it should be automatically hidden when all its members are hidden. This flag is typically assigned to submenus because top-level menus already have this behavior.

This flag should be combined with the DefaultInvisible flag.

Valid for: Button, Combo, Menu
FilterKeysSee the Filtering Keys topic under Combo Element.

Valid for: Combo
FixMenuControllerIf this command is positioned on a menu controller, the command is always the default; that is, the command is selected whenever the menu controller button itself is selected. If the menu controller has the TextIsAnchorCommand flag set, then the menu controller also takes its text from the command that has the FixMenuController flag.

Only one command on a menu controller should have the FixMenuController flag. If more than one command is so marked, the last command in the menu becomes the default command.

Valid for: Button
IconAndTextShow an icon and text on menu and toolbar.

Valid for: Button, Combo, Menu
NoAutoCompleteAuto-complete feature is disabled.

Valid for: Combo
NoButtonCustomizeDo not let the user customize this button.

Valid for: Button, Combo
NoKeyCustomizeDo not enable keyboard customization.

Valid for: Button, Combo
NoShowOnMenuControllerIf this command is positioned on a menu controller, the command does not appear in the drop-down list.

Valid for: Button
NotInTBListDoes not appear in the list of available toolbars. This is valid only for Toolbar menu types.

Valid for: Menu
NoToolbarCloseUser cannot close the toolbar. This is valid only for Toolbar menu types.

Valid for: Menu
PictShow only an icon on a toolbar, but only text on a menu. If no icon is specified, shows a clickable blank space on a toolbar.

Valid for: Button
PostExecMakes the command non-blocking. The development environment defers execution until all pre-processing queries are completed.

Valid for: Button
RouteToDocsThe command is routed to the active document.

Valid for: Button
StretchHorizontallyWhen this flag is set, the width becomes the minimum width for the combo box, and if there is room on the toolbar, the combo box stretches to fill available space. This occurs only if the toolbar is horizontally docked, and only one combo box on the toolbar can use the flag (the flag is ignored on all except the first combo box).

Valid for: Combo
TextMenuUseButtonUse the ButtonText field for menus. The default field is MenuText if it is specified.

Valid for: Button
TextChangesThe command or menu text can be changed at run time, typically through the QueryStatus method.

Valid for: Button, Menu
TextChangesButtonValid for: Button
TextIsAnchorCommandFor a menu controller, the text of the menu is taken from the default (anchor) command. An anchor command is the last command selected or latched. If this flag is not set, the menu controller uses its own MenuText field. However, clicking the menu controller still enables the last selected command from that controller.

We recommend that you combine this flag with the TextChanges flag.

This flag applies only to menus of type MenuController or MenuControllerLatched.

Valid for: Menu
TextMenuCtrlUseMenuUse the MenuText field on menu controllers. The default field is ButtonText.

Valid for: Button
TextMenuUseButtonUse the ButtonText field for menus. The default field is MenuText if it is specified.

Valid for: Button
TextOnlyShow only text on a toolbar or a menu but no icon even if the icon is specified.

Valid for: Button

Parent Elements

ElementDescription
Buttons ElementProvides a group for Button Element elements.
Menus ElementDefines all the menus that a VSPackage implements.

Visual Studio Command Table (.Vsct) Files

Show: