Valued Contributor
Posts: 77
Registered: ‎06-20-2004
Message 1 of 2 (127 Views)

Create MenuMacro with custom ElementID

127 Views, 1 Replies
09-19-2006 04:13 AM

Why l_nm = new MenuMacro(l_mg, "My Macro", "^C^CMyCommand", "ID_MyTag"); doesn't acceppt my tag string?
The ElementID of the newly created MenuMacro object is set to 'MMU_0001'.

CustomizationSection m_csection;
string mainCuiFile = (string)Application.GetSystemVariable("MENUNAME") + ".cui";
m_csection = new CustomizationSection(mainCuiFile);

if (m_csection.MenuGroup.Toolbars.IsNameFree("MY_TBAR"))
MacroGroup l_mg = m_csection.MenuGroup.MacroGroups[0];
MenuMacroCollection l_mm = l_mg.MenuMacros;
MenuMacro l_nm;
Macro l_macro;

Int32 l_mm_idx = l_mm.IndexOf("ID_MyTag");
if (l_mm_idx == -1)
l_nm = new MenuMacro(l_mg, "My Macro", "^C^CMyCommand", "ID_MyTag");

Toolbar l_tb = new Toolbar("MY_TBAR",m_csection.MenuGroup);
l_tb.ToolbarOrient = ToolbarOrient.floating;
l_tb.ToolbarVisible = ToolbarVisible.show;

ToolbarControl l_tbctrl = new ToolbarControl(ControlType.NamedViewControl,l_tb,-1);

ToolbarButton l_button = new ToolbarButton(l_tb,-1);
l_button.Name = "MyButton";
l_button.MacroID = "ID_MyTag";

foreach(Workspace wk in m_csection.Workspaces)
WorkspaceToolbar l_wstb = new WorkspaceToolbar(wk,l_tb);
l_wstb.Display = 1;
catch (System.Exception ex)
Active Contributor
Posts: 43
Registered: ‎04-03-2007
Message 2 of 2 (127 Views)

Re: Create MenuMacro with custom ElementID

03-31-2008 10:00 AM in reply to: Torokze
did you ever resolve this problem?
I'm experiencing the same difficulty.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.