C# API Addin Creating Menu

Hi Everyone,

It might seem a little "noobish" but the SW C# template baffles me.

I am using SW2013 and creating the Add-In using Visual Studio Express 2010.

There are four applications I need to run from my Add-In.

When I create a new project, I get a beautiful menu right by the File submenu that shows all four applications - correct.

On the other hand, on the Toolbar created I get the following:

  • I get two Icons of the first two menu Items I have
  • I also get a menu named exactly the same as the "Tooltip" of the Toolbar that includes all the menu Items.

What I want is to reach a situation whereI have the following:

  • I want the menu items on the main menu Right by the "File" submenu
  • I want all the menu Items on the toolbar as Icons
  • I DON"T want the drop down menu on the toolbar with the menu items.

I have deleted everything I could, played around with the HasToolbar and HasMenu Boolean methods, I couldn't achieve my goal.

Are there any "Magic Numbers" in the commands that create these objects that I am not aware of?

This is the skeleton of the program that I have:

========================================

#region UI Methods

public void AddCommandMgr ()

{

ICommandGroup cmdGroup;

if (iBmp == null)

iBmp = new BitmapHandler ();

Assembly thisAssembly;

int cmdIndex0, cmdIndex1,cmdIndex2,cmdIndex3;

string Title = "MyApps", ToolTip = "My Applications";

int [] docTypes = new int []

{

(int)swDocumentTypes_e.swDocNONE,

(int)swDocumentTypes_e.swDocASSEMBLY,

(int)swDocumentTypes_e.swDocPART,

(int)swDocumentTypes_e.swDocDRAWING

};

thisAssembly = System.Reflection.Assembly.GetAssembly ( this.GetType () );

 

// int cmdGroupErr = 0;

bool ignorePrevious = false;

object registryIDs;

//get the ID information stored in the registry

bool getDataResult = iCmdMgr.GetGroupDataFromRegistry ( mainCmdGroupID, out registryIDs );

int [] knownIDs = new int [4] { mainItemID1, mainItemID2, mainItemID3, mainItemID4 };

if (getDataResult)

{

if (!CompareIDs ( (int [])registryIDs, knownIDs )) //if the IDs don't match, reset the commandGroup

{

ignorePrevious = true;

}

}

cmdGroup = iCmdMgr.CreateCommandGroup ( mainCmdGroupID, Title, ToolTip, "", 0);

cmdGroup.LargeIconList = iBmp.CreateFileFromResourceBitmap ( "scApps.ToolbarLarge.bmp", thisAssembly );

cmdGroup.SmallIconList = iBmp.CreateFileFromResourceBitmap ( "scApps.ToolbarSmall.bmp", thisAssembly );

cmdGroup.LargeMainIcon = iBmp.CreateFileFromResourceBitmap ( "scApps.MainIconLarge.bmp", thisAssembly );

cmdGroup.SmallMainIcon = iBmp.CreateFileFromResourceBitmap ( "scApps.MainIconSmall.bmp", thisAssembly );

// int menuToolbarOption = (int)(swCommandItemType_e.swMenuItem | swCommandItemType_e.swToolbarItem);

cmdIndex0 = cmdGroup.AddCommandItem ( "CUObject",0, "Create a New oBject or update an existing one", "CUObject", 0, "callNuPart", "", mainItemID1 );

cmdIndex1 = cmdGroup.AddCommandItem ( "ShadowFiles", -1, "Create Neutral Files", "ShadowFiles", 0, "shadowFiles", "", mainItemID2 );

cmdIndex2 = cmdGroup.AddCommandItem ( "AddParams", -1, "Add Parameters with Default Values to Object", "AddParams", 0, "addParams", "", mainItemID3 );

cmdIndex3 = cmdGroup.AddCommandItem ( "ModelInfo", -1, "Information about current Object", "ModelInfo", 0, "modelInfo", "", mainItemID4 );

cmdGroup.HasToolbar = true; //If set to false, the apps are without the Icons and there is a blanked out group named "Form New Subassembly"

cmdGroup.HasMenu = true; //If set to false, the applications won't show up in the main menu, together with File, Edit etc.

cmdGroup.Activate ();

SolidworksApi macros