Author Topic: Modifying Visio UI - Backstage?  (Read 6419 times)

0 Members and 1 Guest are viewing this topic.

ctrollen

  • Newbie
  • *
  • Posts: 6
Modifying Visio UI - Backstage?
« on: September 24, 2010, 10:22:06 AM »
In Visio 2007, my add-in modifies the standard UI such that some custom menu/toolbar items are added and some standard ones are removed.  It does this using the CSVUIObject class, which loads a .vsu file containing the modified UI.  It seems that it is "all change" in Visio 2010!

I have already managed to add a custom ribbon (based on the Visio 2010 SDK sample) and from what I've found out so far, it seems that I can modify the standard Visio UI using the same ribbon XML as I do for the custom items.

Firstly, I wanted to remove or disable the Open command from the File menu and I managed to achieve this by adding the following XML to the ribbon XML file.
  <commands>
    <command idMso="FileOpen" enabled="false"/>
  </commands>

Now I want to remove/hide/disable the Recent tab from the File menu but am having no success.  From various bits of online documentation it seems that the following XML should work:
  <backstage>
    <tab idMso="TabInfo" visible="false"/>
  </backstage>

However, this is not working.  Not only is it not working, it means that my custom ribbon doesn't seem to load at all! 

I cannot see any specific errors being generated - it just seems to fail silently.  Bear in mind that the code is mainly the SDK sample code, so I'm not overly familiar with what everything does - it's a small miracle that I got the custom ribbon working in the first place.

Am I gong about this the right way? Because I managed to get the File/Open disabled fairly easily, I was hoping that something similar would work OK for the Recent File List.  Maybe there is a better way to achieve this.

Thanks in advance,
Chris

Nikolay

  • Hero Member
  • *****
  • Posts: 1125
    • UnmanagedVisio
Re: Modifying Visio UI - Backstage?
« Reply #1 on: September 24, 2010, 03:09:19 PM »
Hi Chris,

If Visio silently does not load your customization then it might indicate that you have some errors (syntax or semantic) in your ribbon XML.
In case you open your ribbon XML in Visual Studio, you should have these errors underlined.

A while ago I've posted an example that removes almost EVERYTHING (including all backstage items, i.e. "Recent" tab too). You could take a look at the source ribbon XML - it's the only thing in the VBA project in that drawing... Means, in principle, backstage customization in Visio does work.
« Last Edit: September 24, 2010, 03:12:08 PM by Nikolay »

ctrollen

  • Newbie
  • *
  • Posts: 6
Re: Modifying Visio UI - Backstage?
« Reply #2 on: September 27, 2010, 03:32:40 AM »
Hi Nikolay,

I've seen your example so I know it can be done, but couldn't work out how (or if I was meant to be able) to see the ribbon XML.   Is it possible to view it?

I can't see anything wrong with my XML, but there's something that Visio doesn't like.  I only need to add the <backstage> section exactly as shown in my previous post for it to sart failing.  Remove it, and it's all OK again!  Visual Studio doesn't show any errors in it either.

Cheers,
Chris




ctrollen

  • Newbie
  • *
  • Posts: 6
Re: Modifying Visio UI - Backstage?
« Reply #3 on: September 27, 2010, 09:59:13 AM »
Aha - progress  :)

It seems that the <backstage> tag needs to be after any other ribbon cusomizations.  From the web page http://www.rondebruin.nl/backstage.htm

Important:
If you have also xml that change the Ribbon add the xml for Backstage then above the last line </customUI>
Reason: It will not work if you add the backstage xml above the xml that change the Ribbon.