CMDPLACEMENT_SECTION – CMDPLACEMENT_END

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The CMDPLACEMENT_SECTION – CMDPLACEMENT_END section allows buttons, groups, and menus to be placed into more than one group or menu. This eliminates the need to completely redefine these items in order to modify the look of a user interface.

The CMDPLACEMENT_SECTION – CMDPLACEMENT_END section is optional: If none of your commands, groups, or menus needs to be placed in a secondary location, you do not need to include this section in your .ctc file.

The Command Placement Entry

A command placement entry is defined in the CMDPLACEMENT_SECTION – CMDPLACEMENT_END section. A command placement entry has three fields, separated by commas and ending with a semicolon. For example:

Item ID, Parent ID, Priority;

These fields are described in the following table. The last field of each entry must end with a semicolon. See "The Command Entry Fields" section later in this topic for more details on each field.

Field

Description

Item ID

A GUID:ID pair identifying the command, group or menu being placed by this entry.

Parent ID

A GUID:ID pair identifying a group or menu in which the item is to be placed.

Priority

A value used to position this item relative to other items in the parent group or menu. This value overrides the Priority field in the item's command entry, menu entry, or group entry itself.

Command Placement Example

The following code example from theFile Explorer sample shows the CMDPLACEMENT_SECTION – CMDPLACEMENT_END section.

CMDPLACEMENT_SECTION
// Commands appearing in multiple groups
    // Command                                 Parent                               Priority
    guidVSStd97:cmdidPropSheetOrProperties,    guidEUGrp:IDG_FILEPANE_PROPS,        0x0010;
    guidVSStd97:cmdidPropSheetOrProperties,    guidEUGrp:IDG_FOLDERPANE_PROPS,      0x0010;
    guidVSStd97:cmdidPropSheetOrProperties,    guidEUGrp:IDG_FOLDERCTX_PROPS,       0x0010;
    guidEUCmd:cmdidFilesOpenFile,              guidEUGrp:IDG_FILEPANECTX_COMMANDS,  0x0010;
    guidEUCmd:cmdidFilesPreviewFile,           guidEUGrp:IDG_FILEPANECTX_COMMANDS,  0x0015;

// Groups appearing in multiple menus
    guidEUGrp:IDG_FILEPANE_REFRESH,            guidEUGrp:IDM_CTX_FILESYSFILE,       0x0040;
    guidEUGrp:IDG_FILEPANE_PROPS,              guidEUGrp:IDM_CTX_FILESYSFILE,       0xFF00;
    guidEUGrp:IDG_FILESYSCTX_COMMANDS,         guidEUGrp:IDM_CTX_FILESYSFOLDER,     0x0040;
CMDPLACEMENT_END

The Command Entry Fields

Each entry in the CMDPLACEMENT_SECTION – CMDPLACEMENT_END section contains three fields. A comma separates all fields and a semicolon denotes the end of each entry. The fields, in order, are:

  • Item ID

    The Item ID field identifies the item being placed, be it a command, menu, or group. The Item ID field is always a GUID:ID pair.

    Some Item ID fields in the example are:

    guidVSStd97:cmdidPropSheetOrProperties, // a command
    guidEUCmd:cmdidFilesOpenFile,           // a command
    guidEUGrp:IDG_FILEPANE_REFRESH,         // a group
    guidEUGrp:IDM_CTX_FILESYSFOLDER,        // a menu
    
  • Parent ID

    The Parent ID field identifies the group or menu into which the item is placed. The Parent ID field is always a GUID:ID pair. Items may be placed in multiple secondary locations and there is no practical limit to the number of locations an item may be placed. However, the following rules must be observed when placing an item:

    • Commands can only be placed into groups. They cannot be placed directly into a menu.

    • Groups can only be placed into menus. You cannot place a group into another group.

    • Menus can only be placed into groups. You cannot place a menu into another menu.

    Some Parent ID fields in the example are:

    ,guidEUGrp:IDG_FILEPANE_PROPS,        // A group
    ,guidEUGrp:IDG_FILEPANECTX_COMMANDS,  // A group
    ,guidEUGrp:IDM_CTX_FILESYSFILE,       // A menu
    
  • Priority

    The Priority field determines the relative position of the item within its parent container. Items with smaller priority numbers appear before those with larger priority numbers.

    The priority specified by an entry in the CMDPLACEMENT_SECTION - CMDPLACEMENT_END section overrides the priority in the item's definition.

    Some Priority fields in the example are:

    ,0x0010
    ,0x0015
    ,0xFF00
    

See Also

Concepts

Command Table Format Reference

How VSPackages Add User Interface Elements to the IDE