Repost: Event before menu displayed

D

David Thielen

Hello;

In my add-in, I need to enable/disable menu items based on the caret
position. Is there a better solution than the selection change event (which
is both very expensive and does not fire on all caret movements)?

All I need is an event that is fired just before any main menu is displayed
(like exists for the RMB pop-up menu).

thanks - dave
 
D

David Thielen

I tried that. I added the code:

// This Application is the Word application object - type Application
ThisApplication.CommandBars.OnUpdate +=new
_CommandBarsEvents_OnUpdateEventHandler(CommandBars_OnUpdate);

Which I stepped over in the debugger fine so it added the event. But the
event never fired. Is there something else I need to do or do I need to add
the event at some specific place?

thanks - dave
 
D

David Thielen

Hi;

You know, I think PIAs should actually be called PITAs. Yes, adding a
class-level member variable was needed so the event would fire. That's the
good news.

The bad news is the event does not fire when a menu is about to be
displayed. From reading the documentation it sounds like it fires when a
change is made to a menu. But in my case there is no change to the menu, I
need to enable/disable when the menu is about to be displayed.

Any other approaches?

thanks - dave
 

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