View Single Post
  #4  
Old December 11th 06, 03:23 PM posted to microsoft.public.outlook.program_forms
Nikolas
external usenet poster
 
Posts: 34
Default multiple ribbons with the same ribbonID

Thanks Ken that worked perfectly.

One more question plz: My custom groups in the Ribbon of the forms depend on
the RibbonID. Since the GetCustomUI(string ribbonID) function gets called
only once, when the Ribbon is first loaded for a given RibbonID, how else can
I find out the RibbonID of an inspector in order to use it in the callback
functions? So far I looked in the Inspector class and in the MailItem class
but didn't find any property there.

Thanks in advance.
Nikolas

"Ken Slovak - [MVP - Outlook]" wrote:

It's a matter of timing most likely. I've had to deal with two different
timing problems related to ribbons and Inspectors.

The first time an Inspector is instantiated for a ribbon the Ribbon_OnLoad
function hasn't fired yet. So any ribbon references aren't valid. What I do
is set up a dummy Office.IRibbonUI object at module level, knowing it's a
dummy that first time around and will be null (Nothing) until Ribbon_OnLoad
fires.

I have a module level Office.IRibbonUI object in each Inspector wrapper
class that is null for the first Inspector. After that the ribbon object is
valid and the class ribbon object is instantiated when I add the new
Inspector to my wrapper class collection.

In Ribbon_OnLoad I iterate the Inspectors wrapper class collection and
instantiate each ribbon object in each wrapper class.

To take care of the second problem I call the invalidate code in the
Inspector Activate event that fires within my Inspector wrapper class. I can
either call InvalidateControl or if I want everything to be refreshed I can
call Ribbon.Invalidate, which invalidates everything.

See if that helps.

It works in my addin templates for my book. I've used it so far with VB6,
VB.NET, C#, VSTO/VB.NET and VSTO/C# addin templates.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Nikolas" wrote in message
...
Hi Ken,

Thanks for your suggestion (created two custom groups in the ribbon and I
toggle their visibility). Everything looked to work fine apart from an
issue
with the refresh of the Ribbon. It looks like the Ribbon doesn't refresh
everytime a new inspector (of the same type (ex. Mail.Compose) is created
and
displayed. I put a breakpoint in the callback functions that determine the
visibility of the buttons in the custom Ribbon groups (depending on the
Message Class of the Mail Item) and randomly ignores some calls. I tried
putting calls of the function InvalidateControl("MyRibbonGroupName") to
the
function that creates the Inspector but this didnt solve my problem.

Any suggestions would appreciated.

Nikolas



Ads