Can't add to Tools menu

B

b.alex

Hi,

I've written code that adds items to menus, and it works great. The only
difficulty is in adding to the Tools menu. As soon as documents get open or
closed, Visio appears to be wiping out any modifications to the Tools menu.

I can, for example, add an item to the Tools menu in the application's
custom menu, but the same code applied to the document's custom menu doesn't
work. I've even tried postponing my modification until the VisioIsIdle or
NoEventsPending event after a document is opened. My item still doesn't
appear.

Is there some special behavior of the Tools menu? Is there an event I can
wait for and know that Visio is no longer modifying the menu? Am I on the
wrong track entirely? Any help would be appreciated.

Thank you,
Bob Alexander
 
B

b.alex

The mystery deepens: if I run the UIObjectBrowser application written by
Graham Wideman (author of "Visio 2003 Developer's Survival Pack"), it shows
that my menu item has been added to the document's custom menu, context ID 2,
on the Tools menu in the position I wanted it, and its Visible property is
true. And still, when I pull down the Tools menu, it's not there.

- Bob
 
C

Chris Roth [MVP]

Hi Bob,

Two ideas from my armchair, without getting up to try anything... : )

1. Do you have any other add-ons installed that might be altering the menus?
(Or which template are you loading - perhaps Visio is modifying the UI...)
2. Is the command that your button is bound to valid? I can't remember
off-hand, but I think if your command is wrong, then Visio either disables
the item, or doesn't show it (I think it disables, which isn't what you're
seeing)

Maybe post a stripped down version of your code, if we can't figure it
out...?

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/
 
J

John Goldsmith

Hello Bob / Chris,

I ran into this problem a year ago or so and was unable to solve it. I had
exactly the same experience using Graham's tool. As I remember if code
modifies the existing menus (such as adding a menu item to the bottom of the
Tools menu) using the UIObject, the menu items fail to display IF the
retrieved UIObject is based on an Application.CustomMenus rather than
Application.BuiltInMenus. In contrast, code that adds a new menu (such as
adding a "MyMenu" menu after the Help menu) behaves correctly in all
circumstances.

My advice would be to either use the Commandbars approach or add a new menu
before or after the Tools menu. At least your remaining development
shouldn't be held up and if a solution is found it would be a fairly quick
fix to return your items to the Tools menu.

If anyone's interested, I have a test file displaying the problem that I'm
more than happy to share.

Hope that's of some help.

Best regards

John


John Goldsmith
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 

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