AnsweredAssumed Answered

SolidWorksAddIn: ContextMenu

Question asked by Erhard Wuertz on Feb 8, 2016
Latest reply on Feb 15, 2016 by Erhard Wuertz

Hi,

 

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);

cgMnuCtx.Activate();

 

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

Outcomes