.NET

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

Create MenuMacro with custom ElementID

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

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

try
{
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");
l_mm.Add(l_nm);
}

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);
wk.WorkspaceToolbars.Add(l_wstb);
l_wstb.Display = 1;
}
}
}
catch (System.Exception ex)
{
}
Active Contributor
perry59
Posts: 43
Registered: ‎04-03-2007
Message 2 of 2 (123 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.
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.