2 Replies Latest reply on Feb 15, 2016 4:16 AM by Erhard Wuertz

    SolidWorksAddIn: ContextMenu

    Erhard Wuertz



      I created a contextmenu like this:






      ICommandGroup cgMnuCtx;


      cgMnuCtx = iCmdMgr.AddContextMenu(menuItem1, "MyMenu");

      cgMnuCtx.set_MenuPosition(2, 0);

      cgMnuCtx.SelectType = (int)swSelectType_e.swSelFACES;


      cgMnuCtx.LargeIconList = iBmp.CreateFileFromResourceBitmap("TestAddInSoldWorks.ToolbarLarge.bmp", thisAssembly);          
      cgMnuCtx.SmallIconList = iBmp.CreateFileFromResourceBitmap(
      "TestAddInSoldWorks.ToolbarSmall.bmp", thisAssembly);
      cgMnuCtx.LargeMainIcon = iBmp.CreateFileFromResourceBitmap(
      "TestAddInSoldWorks.MainIconLarge.bmp", thisAssembly);
      cgMnuCtx.SmallMainIcon = iBmp.CreateFileFromResourceBitmap(
      "TestAddInSoldWorks.MainIconSmall.bmp", thisAssembly);

      cmdIndex100 = cgMnuCtx.AddCommandItem2(
      "test", 1, "My Menu item", "", -1, "DoSomeThing", "WhatToDo", menuItem1, menuToolbarOption);



      This is OK and the method "DoSomeThing" will work.


      Now my question:


      How can I create a menu position, which has no submenu and can be directly execute by a mouse click.


      Best regards


      Erhard Wuertz