Sdílet prostřednictvím


CMDS_SECTION – CMDS_END

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

The CMDS_SECTION – CMDS_END of a command table configuration (.ctc) file may have up to five subsections where user interface elements can be grouped according to type (bitmaps, buttons, combos, menus, or groups) and defined.

Subsections

The CMDS_SECTION subsections, which are described in separate topics, are as follows:

The package GUID in the CMDS_SECTION – CMDS_END section indicates "delay load." This means that the package is loaded only when the commands in that group are enabled. If the package is not loaded, the commands are displayed on toolbars or menus in their default state. For example, even if a command is invisible or disabled by default but can become visible or enabled in the current context, it will not be displayed or enabled until the package associated with it is loaded. If the command is enabled by some other process, the package that the command is associated with, as defined in the CMDS_SECTION, is loaded to execute the command.

Example

The following example shows the code that is required to produce a shortcut menu.

CMDS_SECTION guidVJPackage
    MENUS_BEGIN
        guidVJGrp:IDM_MYCONTEXT,
            guidVJGrp:0, 0x0000, CONTEXT, "MyContextMenu", "&MyMenu";
    MENUS_END
    NEWGROUPS_BEGIN
        guidVJGrp:IDG_CUTCOPY,     guidVJGrp:IDM_MYCONTEXT,  0x0100;
        guidVJGrp:IDG_OVERRIDE,    guidVJGrp:IDM_MYCONTEXT,  0x0300;
        guidVJGrp:IDG_PROPERTIES,  guidVJGrp:IDM_MYCONTEXT,  0x0500;
    NEWGROUPS_END
    BUTTONS_BEGIN
        guidVJCmd:VJCmdCut,   guidVJGrp:IDG_CUTCOPY,  0x0100,
            guidOfficeIcon:msotcidCut,   BUTTON, , "Cut";
        guidVJCmd:VJCmdCopy,   guidVJGrp:IDG_CUTCOPY,  0x0200,
            guidOfficeIcon:msotcidCopy,   BUTTON, , "Copy";
        guidVJCmd:VJCmdPaste,   guidVJGrp:IDG_CUTCOPY,  0x0300,
            guidOfficeIcon:msotcidPaste,   BUTTON, , "Paste";
        guidVJCmd:VJCmdOverride,   guidVJGrp:IDG_OVERRIDE,  0x0100,
            guidOfficeIcon:msotcidNoIcon,   BUTTON, , "Override 
            Method";
        guidVJCmd:VJCmdProperties,   guidVJGrp:IDG_PROPERTIES,  0x0100,
            guidOfficeIcon:msotcidProperties,   BUTTON, ,
                "View Properties", "&Properties";
    BUTTONS_END
CMDS_END

For a more full-featured example of a .ctc file, see File Explorer.

See Also

Concepts

How VSPackages Add User Interface Elements to the IDE

Other Resources

Command Table Configuration (.Ctc) Files

Menus and Toolbars