S
SomeNewDev
Hello,
yesterday I saw this webcast about 'Visio 2007 for developers' by Senaj Lelic.
It was recommended _NOT_ to use the CommandBars in Visio add-ins coz of bugs.
And yes, seems I've already noticed them acting wild sometimes.
So I switched to Visio's ToolbarItems and MenuItems collections.
Adding them works ok so far. But it was NOT shown how to add events
to their items, and I still can't figure it out.
Well, in the SDK only CommandBars are used... nowhere to look it up then :?
Could somebody post a snippet please ?
Thanks.
PS: This is what I've got so far:
[...]
Visio.UIObject VisioUIO;
Visio.MenuSet CurrentVisioMenuSet;
Visio.Menu FMVisioMenu;
Visio.MenuItems menuItems;
Visio.MenuItem menuItem;
VisioApp = Application;
if (Application.CustomMenus != null)
VisioUIO = Application.CustomMenus;
else
VisioUIO = Application.BuiltInMenus;
CurrentVisioMenuSet = VisioUIO.MenuSets.get_ItemAtID(
(int)Visio.VisUIObjSets.visUIObjSetDrawing);
FMVisioMenu = CurrentVisioMenuSet.Menus.AddAt(8);
FMVisioMenu.Caption = "&My Menu";
menuItems = FMVisioMenu.MenuItems;
menuItem = menuItems.Add();
menuItem.Caption = "&Start";
VisioApp.SetCustomMenus(VisioUIO);
[...]
yesterday I saw this webcast about 'Visio 2007 for developers' by Senaj Lelic.
It was recommended _NOT_ to use the CommandBars in Visio add-ins coz of bugs.
And yes, seems I've already noticed them acting wild sometimes.
So I switched to Visio's ToolbarItems and MenuItems collections.
Adding them works ok so far. But it was NOT shown how to add events
to their items, and I still can't figure it out.
Well, in the SDK only CommandBars are used... nowhere to look it up then :?
Could somebody post a snippet please ?
Thanks.
PS: This is what I've got so far:
[...]
Visio.UIObject VisioUIO;
Visio.MenuSet CurrentVisioMenuSet;
Visio.Menu FMVisioMenu;
Visio.MenuItems menuItems;
Visio.MenuItem menuItem;
VisioApp = Application;
if (Application.CustomMenus != null)
VisioUIO = Application.CustomMenus;
else
VisioUIO = Application.BuiltInMenus;
CurrentVisioMenuSet = VisioUIO.MenuSets.get_ItemAtID(
(int)Visio.VisUIObjSets.visUIObjSetDrawing);
FMVisioMenu = CurrentVisioMenuSet.Menus.AddAt(8);
FMVisioMenu.Caption = "&My Menu";
menuItems = FMVisioMenu.MenuItems;
menuItem = menuItems.Add();
menuItem.Caption = "&Start";
VisioApp.SetCustomMenus(VisioUIO);
[...]