.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create MenuMacro with custom ElementID

1 REPLY 1
Reply
Message 1 of 2
Torokze
294 Views, 1 Reply

Create MenuMacro with custom ElementID

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)
{
}
1 REPLY 1
Message 2 of 2
perry59
in reply to: Torokze

did you ever resolve this problem?
I'm experiencing the same difficulty.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost