none
VSCT : How to add a menu group to the Context Menu ? RRS feed

  • Question

  • I am currently working on a DSL Tools project with the VS 2008 SDK. I have a fully functional VSCT file. Unfortunately, the context menu is getting a bit crowded and I am trying to  tidy up its apperance by separating the commands into menu groups. Adding individual buttons to the context menu works just fine. Adding a group works for context menus elsewhere in the project, but not for the main one. Everything compiles, but the menu group remains invisible. Am I doing something incorrectly ?

    <!--

     

     This button is added correctly to the context menu. -->
    <
    Button guid="guidCmdSet" id="cmdAbout" priority="0x1010" type="Button">
    <
    Parent guid="guidCmdSet" id="grpidContextMain" />
    <
    Icon guid="guidAboutIcon" id="1" />
    <
    Strings>
    <
    CommandName>cmdAbout</CommandName>
    <
    ButtonText>About ...</ButtonText>
    </
    Strings>
    </
    Button>

    ...

    <!--

     

     This menu group is added correctly to the project's node context menu. -->
    <
    Group guid="guidCmdSet" id="GraphCommands_ContextMenuGroup" priority="0x1020">
    <
    Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>
    </
    Group>

     

     

    ...

    <!--

     

     This menu group is never visible within the main context menu. -->
    <
    Group guid="guidCmdSet" id="GraphCommands_ContextMenuGroup" priority="0x1020">
    <
    Parent guid="guidCmdSet" id="grpidContextMain"/>
    </
    Group>

     

     


    No errors nor warning are shown, so I am a bit stumped about what I could be doing wrong. Any tip would be appreciated.

    MLavallee






    Friday, July 10, 2009 2:50 PM

Answers

All replies

  • Seems you are going to add a new Context MenuItem for the existing Project Node contextMenu. In that case check your group parent details.
    <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE"/>

    Here is a video tutoral for that...


    CJ
    • Proposed as answer by CharithJ Friday, July 10, 2009 5:10 PM
    • Marked as answer by Nancy Shao Friday, July 17, 2009 3:41 AM
    Friday, July 10, 2009 5:10 PM
  • Hi,

    As CJ suggestion, you could refer to  How Do I: Place My Commands Into Different Kinds of Visual Studio Menus? Video. There is detailed information about place my commands into Visual Studio Menus in this video.

    Best Regards,
    Nancy
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by MLavallee Friday, July 17, 2009 3:11 PM
    • Unmarked as answer by MLavallee Friday, July 17, 2009 3:14 PM
    • Marked as answer by MLavallee Friday, July 17, 2009 3:29 PM
    Friday, July 17, 2009 3:41 AM
  • Thank you ! Reviewing the video outlined a detail I missed. I am posting here the resulting code.

    The solution presented in the video shows how to add a group item to a general VSX context menu. This adds a group item to the context menu of the hive.

    <!--

     

    Definition of a Graph Commands group, for the Context Menu -->
    <
    Group guid="guidCmdSet" id="GraphCommands_ContextMenuGroup" priority="0x1060">
    <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"/>
    </
    Group>

     

     

     

     

     

    Unfortunately it doesn't work for the DSL Tools. The previous group is actually shown on the context menu linked with the XML file. If a diagram is opened in XML, then the context menu is IDM_VS_CTXT_CODEWIN. The DSL Tools diagram-view context menu uses a different menu however !

    <!-- Definition of a Graph Commands group, for the Context Menu -->
    <
    Group guid="guidCmdSet" id="GraphCommands_ContextMenuGroup" priority="0x1060"
    >
    <
    Parent guid="guidCmdSet" id="menuidContext"
    />
    </Group>


    The menuidContext is the context menu for the DSL Tools diagram-view context menu. This context menu is defined in the GeneratedVSCT file within the DslPackage project. I am guessing that all menu ressources specific to the DSL Tools are defined in the "GeneratedVSCT.vsct" and not in the common VSX header files.

    Thanks for the help !
    Friday, July 17, 2009 3:11 PM
  • =============== Comment - do not propose as answer ===============

    Typo: 'tutoral' - replace with 'tutorial' by copying and pasting or adding an 'i' just before 'al'


    Tuesday, July 2, 2019 11:38 PM