Adding sub-menus in Outlook toolbar button?

W

WLAN

Hello All,

How do I add submenus to a toolbar button? I saw some toolbar buttons like
Send/Receive,Outlook Spy-Misc button etc are adding submenus for a tool bar
button.

Is there any mechanism for doing so?

Thanks in Advance
 
K

Ken Slovak - [MVP - Outlook]

Those "buttons" are CommandBarPopupControls. You add one of those, get its
CommandBar property and then add the buttons that make up the submenu to
that CommandBar object. That can be repeated by adding more
CommandBarPopupControls as needed.
 
K

Ken Slovak - [MVP - Outlook]

Yes for Explorers, yes sort of for Inspectors. With Inspectors in Outlook
2007 you have the ribbon. If you use CommandBars instead of the ribbon in
Outlook 2007 Inspectors your UI gets stuck in the Addins tab along with any
other CommandBars added by other programs.
 
W

WLAN

Hi,

My requirements is to populate this popup sub-menu based on some condition.
So my menu have 5 or 10 sub-menus based on some condition.

Can I get any events for sub-menus added dynamically?

thanks
 
K

Ken Slovak - [MVP - Outlook]

If you use the Ribbon dynamic menu control it has a getContent callback you
can utilize that is used to supply XML for that ribbon control when the
control is first initialized and then for each InvalidateControl() call for
that control and for all Invalidate() calls. When you are in that callback
you can supply your own dynamic XML for the ribbon control that varies based
on whatever conditions you set.

I do that myself in a few addins where I create the XML for the dynamic menu
control on the fly based on current conditions. The XML must of course be
syntactically correct.

For buttons and popups and such with the CommandBars interface I use wrapper
classes that have the buttons and button event handlers and use a collection
to hold the dynamically added wrapper classes, one for each button or
submenu I'm adding.
 

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