gkar68

ICommandBar refersh

Discussion created by gkar68 on Jan 30, 2013
Hi
I am migrating a 9.3 based Desktop extension, to 10.1
The Extension, is building toolbars on the fly.
It creates the toolbar, and add the commands to it.
This is the snippets of the code that does this

ICommandBar commandBar = Document.CommandBars.Create("name", ESRI.ArcGIS.SystemUI.esriCmdBarType.esriCmdBarTypeToolbar);

commandBar.Dock(....);

int indexAsObject = commandBar.Count;
commandBar.add((ToolContainer) item, ref indexAsObject);
.....
.... (repeat the above statement to add all commands)
....

ICommandItem toolbarAsCommandItem = (ICommandItem) commandBar;
toolbarAsCommandItem.Refresh();
toolbarAsCommandItem.Tag = tagvalue;


The above code is working on 9.3

But on 10.1, it is adding the commands correctly, but the commandBar is not refreshed, and it is empty
The toolbars are shown empty, and without any name.
The product I am using is ArcMap, and I am calling the above code from

IDocument.NewDocument event


Any idea?

Outcomes