Command Flag Element

Modifies its parent element.

<CommandFlag>DynamicVisibility</CommandFlag>

Attributes and Elements

The following section describes valid element values.

Attributes

None.

Child Elements

Value

Description

AllowParams

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

Valid for: Button

AlwaysCreate

Menu is created even if it has no groups or buttons.

Valid for: Menu

CaseSensitive

User entries are case-sensitive.

Valid for: Combo

CommandWellOnly

Apply 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

DefaultDisabled

By 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

DefaultDocked

Docked by default. This setting no longer applies to toolbars because they are always docked.

DefaultInvisible

By 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

DontCache

The 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

DynamicItemStart

Indicates 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

DynamicVisibility

The 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

FilterKeys

See the Filtering Keys topic under Combo Element.

Valid for: Combo

FixMenuController

If 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

IconAndText

Show an icon and text on menu and toolbar.

Valid for: Button, Combo, Menu

NoAutoComplete

Auto-complete feature is disabled.

Valid for: Combo

NoButtonCustomize

Do not let the user customize this button.

Valid for: Button, Combo

NoKeyCustomize

Do not enable keyboard customization.

Valid for: Button, Combo

NoShowOnMenuController

If this command is positioned on a menu controller, the command does not appear in the drop-down list.

Valid for: Button

NotInTBList

Does not appear in the list of available toolbars. This is valid only for Toolbar menu types.

Valid for: Menu

NoToolbarClose

User cannot close the toolbar. This is valid only for Toolbar menu types.

Valid for: Menu

Pict

Show 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

PostExec

Makes the command non-blocking. The development environment defers execution until all pre-processing queries are completed.

Valid for: Button

RouteToDocs

The command is routed to the active document.

Valid for: Button

StretchHorizontally

When 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

TextMenuUseButton

Use the ButtonText field for menus. The default field is MenuText if it is specified.

Valid for: Button

TextChanges

The command or menu text can be changed at run time, typically through the QueryStatus method.

Valid for: Button, Menu

TextChangesButton

Valid for: Button

TextIsAnchorCommand

For 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

TextMenuCtrlUseMenu

Use the MenuText field on menu controllers. The default field is ButtonText.

Valid for: Button

TextMenuUseButton

Use the ButtonText field for menus. The default field is MenuText if it is specified.

Valid for: Button

TextOnly

Show only text on a toolbar or a menu but no icon even if the icon is specified.

Valid for: Button

Parent Elements

Element

Description

Buttons Element

Provides a group for Button Element elements.

Menus Element

Defines all the menus that a VSPackage implements.

See Also

Other Resources

Visual Studio Command Table (.Vsct) Files