Adding a new toolbar displays the "no document" toolbar

S

Stéphane

Hi,

I want to add a new toolbar in my visio when I create a new document. It
works, but the "no document" toolbar is always displayed when I add my new
toolbar. I use Visio 2002. I send you the c# code I writed:

private void CreateProcessToolbar(Visio.Document doc) {
Visio.UIObject UIObj;
Visio.ToolbarSet toolbarSetObj;
Visio.Toolbar toolbarObj;
Visio.ToolbarItems toolbarItemsObj;
Visio.ToolbarItem toolbarItemObj;

// get build in toolbars
UIObj = VisioApplication.Instance.get_BuiltInToolbars(0);
toolbarSetObj =
UIObj.ToolbarSets.get_ItemAtID((int)Visio.VisUIObjSets.visUIObjSetDrawing);

//add a new toolbar
toolbarObj = toolbarSetObj.Toolbars.Add();
toolbarObj.Caption =
ResourceHelper.GetStringValue(Constants.KEYS_PM_TOOLBAR_PROCESSMODELER);
toolbarObj.Position = (int)Visio.VisUIBarPosition.visBarMenu;

//add items to toolbar
toolbarItemsObj = toolbarObj.ToolbarItems;
//new sheet
toolbarItemObj = toolbarItemsObj.Add();
toolbarItemObj.Caption =
ResourceHelper.GetStringValue(Constants.KEYS_PM_MENUS_NEWSHEET);
toolbarItemObj.AddOnName = Constants.CALLED_FROM_MAIN_MENU+"
"+Constants.MAINMENU_NEWSHEET;
toolbarItemObj.CntrlType =
(int)Visio.VisUICtrlTypes.visCtrlTypeBUTTON;
toolbarItemObj.FaceID = 270;
// attribute explorer
toolbarItemObj = toolbarItemsObj.Add();
toolbarItemObj.Caption =
ResourceHelper.GetStringValue(Constants.KEYS_PM_MENUS_EXPLORER_ATTRIBUTES);
toolbarItemObj.AddOnName = Constants.CALLED_FROM_MAIN_MENU+"
"+Constants.MAINMENU_EXPLORER_ATTRIBUTES;
toolbarItemObj.CntrlType = (int)Visio.VisUICtrlTypes.visCtrlTypeBUTTON;
toolbarItemObj.FaceID = 281;

doc.SetCustomToolbars(UIObj);

}

Thank you for the help

Stéphane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top