Ribbon Control questions

T

Tom

Hi All,

I have a few questions about the ribbion control.

1. How do I query for my ribbon control at run time? What interface am I
supposed to use?
2. Can I add/remove items dynamically at runtime from a ribbon control
combobox?
3. Are there and C++ (or VB) examples anywhere that fully demonstrate all
the controls?

Thanks,
Tom
 
K

Ken Slovak - [MVP - Outlook]

It's hard to be specific since you didn't mention what version of Outlook,
what version of VS, what version of VB, whether this is for unmanaged or
managed code and if managed whether a shared addin or a VSTO addin, or much
of anything else.

There's no one article that I've seen that covers everything and every
variation of handling things with the ribbon, but start with the article at
http://msdn.microsoft.com/en-us/library/aa338202.aspx. You can also go to
the Office Developer Web site at MSDN and download a lot of information,
references of ribbon id's, samples and so on.
 
T

Tom

Sorry Ken - I am using unmananged code (ATL/C++) and all my add-ins support
Outlook 2000 and above - and any operating systems. Oh - and I am using VS
2008.

I am particularily interested in adding items and controls dynamically at
runtime.

Actually I saw that article you mentioned and it is fine if you want to
statically create controls.

I have searched the net and have not found any articles about adding
combobox items at run time. Can we do that? Can I query the interface from
the application object or inspector?

Thanks,
Tom
 
K

Ken Slovak - [MVP - Outlook]

There's limited support for doing much dynamically with most of the ribbon
controls. There are also limited resources for documentation on working in
unmanaged C++, most of the code samples are in C# or VB.NET, only a few in
VB6. I believe there is some C++ at www.outlookcode.com.

I mostly use a dynamicMenu control when I want something to be truly
dynamic. As far as adding members to the combobox ore dropdown list, that
can be done to a degree. You can't really query the interface, but you can
force callbacks by invalidating that control or all of your controls using
InvalidateControl("myControl") or InvalidateControls().

I've used dropdown controls with their onAction, getItemCount, getItemID,
getItemLabel and getSelectedItemIndex callbacks to control the list at
runtime. For example creating a dropdown control and displaying a list of
email accounts. Similar things can be done with combos.

For handling Outlook 2000 and above things are different in C++, but for C#
I use a modified set of COMImport statements derived from an article on
Andrew Whitechapel's blog. Andrew used to be on the VSTO team. That article
is at
http://blogs.msdn.com/andreww/archi...or-multiple-office-versions-without-pias.aspx
and there's also a followup article. For VB6 code I use a tlb derived from
the Office 2007 library that exposes the ribbon interfaces
(XLIRibbonExtensibility.tlb) from XL-Dennis's Web site.
 
T

Tom

That is what I thought ken.
But I never thought about invalidating to force a callback - good idea!

I have so many customers who don't like to use the add-in tab for Outlook
2007 because it hides their obvious logic. So they want something visible
that says their company name.

FYI- Also I have numerous requests to add a simple button next to the send
button on the new message window. Are we ever going to be able to do this?
We have actually had clients change their mind about doing anything with
Outlook because of that one lacking feature. For example some companies like
button functionality like -"Send and save on network". And they want it
next to the send button. I think this is one feature that needs to be added
to Outlook.

Thanks again for your input.
 
K

Ken Slovak - [MVP - Outlook]

The Add-Ins tab entries have no discoverability.

It's worse in Outlook 2010 because you also have that for Explorers. In
addition, what you used to add to property pages now is also not
discoverable unless you re-write to use Backstage instead.

To support various versions I now have Inspector ribbons and commandbars,
Explorer ribbons and commandbars, property pages and Backstage all supported
in one addin dll. Lots of version testing and special case code.

You cannot add anything to the big Send button area, nor can you repurpose
that button as you can with most other ribbon controls. My customers have
had to accept either a new ribbon group or tab for that. My information is
that there is no thought to allowing us to customize that button or that
area.

I hate to suggest it, but if there's no compromise you might have to use
start from scratch and design your own ribbon for customers like that from
scratch where you can design what they want. Of course the development costs
may make them decide they'd love the button somewhere else :)

With invalidating you have to check and see which callbacks are forced by
invalidating. Some are not called again, some are, depending on the control
and the callback. So you have to test for suitability for your purposes.
 
T

Tom

Yep - I have already run into the testing debacle. It is really becoming a
pain. We really started to add testing all of our custom addins proposals.
It takes a long time to test each version.

I sometimes wish we could install multiple versions of Outlook on one
desktop (same with IE).
 

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