Valued Contributor
77 Posts
0 Kudos
Registered: ‎06-20-2004
Post 1 of 2

Create MenuMacro with custom ElementID

130 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
43 Posts
0 Kudos
Registered: ‎04-03-2007
Post 2 of 2

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!