Questions on the OutlookRibbonXCS example

E

escamoteur

Hi,

I studied the OutlookRibbonXCS example but don't understand everything completely.

Looking at

public bool ColorWidgetsGroup_GetVisible(Office.IRibbonControl control)
{
Debug.WriteLine("ColorWidgetsGroup_GetVisible");
OutlookInspector window = FindOutlookInspector(control.Context);
if (window != null)
{
Outlook.ContactItem contact = window.CurrentItem;
//Make the group visible only if an address exists
if (String.IsNullOrEmpty(contact.BusinessAddress) &
String.IsNullOrEmpty(contact.HomeAddress) &
String.IsNullOrEmpty(contact.OtherAddress))
{
return false;
}
else
{
return true;
}
}
return false;
}

Why the hassle with the FindOutlookInspector?

It's much easyer to do it like in this Example

public void RibbonCreateFromMailButton_Action(Office.IRibbonControl control)
{
Outlook.Inspector window = (Outlook.Inspector) control.Context;
if (window != null)
{
Outlook.MailItem item = (Outlook.MailItem) window.CurrentItem;
if (item != null)
{
theApp.Instance.BOManager.CreateBOFromMail(item);
}
}


Or do I miss something important here?
Best
Tom
 
B

Brian Tillman [MVP-Outlook]

Hi,

I studied the OutlookRibbonXCS example but don't understand everything
completely.

Looking at

public bool ColorWidgetsGroup_GetVisible(Office.IRibbonControl
control)

Please post programming questions in the programming groups.
microsoft.public.outlook.program_vba seems appropriate to me.
 
K

Ken Slovak - [MVP - Outlook]

I think you misunderstood what Randy was doing. He was using a list to
maintain an Inspector wrapper collection and using that method to try to
locate that Inspector in the wrapper collection list.

Window was what an Inspector was called in that sample.

You can be very sure that Randy knows what he's doing :)
 
E

escamoteur

I think I understood what he wants to achieve with the tracking of inspectors and explorers, but to access the Item of an Inspector
that in the Handler of a Ribbon I think it's not neccessary to do it they hey did, the way I proposed is much more straight forward.
So I wondered what his reason may have been to do it that way.

Best
Tom
 
K

Ken Slovak - [MVP - Outlook]

Most of us use some sort of wrapper collection like Randy's, whether it's a
list/dictionary/sorted list/collection or whatever. It's very necessary and
equally so for the ribbon where you might for example want to maintain
different states for various controls such as drop-downs or toggle buttons
per Inspector or Explorer. I don't see any wasted code there.
 

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