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)
{
}