
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The requirement is to programmatically change the name of a toolbar button.
I am currently getting the toolbar button and changing the value using
CustomizationSection cs;
string mainCuiFile = (string)Application.GetSystemVariable("MENUNAME");
mainCuiFile +=".cuix";
cs = new CustomizationSection(mainCuiFile, false);
ToolbarCollection toolColl = cs.MenuGroup.Toolbars;
foreach (Toolbar toolBar in toolColl)
{
ToolbarItemCollection itemColl = toolBar.ToolbarItems;
foreach (ToolbarItemBase item in itemColl)
{
try
{
if (item is ToolbarButton
&& ((ToolbarButton)(item)).MenuMacroReference !=null)
{
Macro macro = ((ToolbarButton)(item)).MenuMacroReference.macro;
if (macro.Name.ToUpper() == "SYNCHRONISE ...")
macro.Name ="test";
}
}
catch (System.Exception ex){}
}
}
ed.Document.SendStringToExecute(
"cuiunload " + cs.MenuGroup.Name + " ", false, false, false
);
Application.SetSystemVariable("FILEDIA"
, 0);
ed.Document.SendStringToExecute(
"cuiload c:\test.cuix ", false, false, false
);
But the Name of the button does not change.
Please let me know what I am missing here.
Solved! Go to Solution.