View Single Post
  #1  
Old May 21st 09, 07:59 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Using Ribbon in Inspector window

The requirement from MS is that the interface handling and callbacks for the
ribbon must be in the same class as the class that implements the
IDTExtensibility interface. So OO design or not that's what you have to do.

What I do is implement a RibbonClicker() method in the Inspector wrapper
class. I call that method in the wrapper class to handle anything that is
specific to that Inspector, such as the states of toggle controls. In the
ribbon callback I identify which Inspector matches the Inspector in the
wrapper class and then I know which wrapper class to call to. Luckily
Outlook 2007 Inspectors can be compared directly using an equality test (==
or for VB using the Is operator), so finding the correct wrapper class is
easy.

I pass in any needed arguments from the ribbon callbacks to my
RibbonClicker() methods, so anything they need in the way of information is
available to them.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


wrote in message
...
I think I might have figured it out already ... The only think I am
really not happy about is the fact that all of the ribbon stuff gets
handled inside my CAddin class. It should really be the job of the
individual CInspectorWrappers. Is it possible to do it that way? Right
now I seem to have quite a lot of unnecessary nearly duplicate code
around in separate classes (once for toolbars and the other time for
ribbons) This could one day be a debugger's nightmare ...


Ads