Outlook 2007 Ribbon Minimized ComboBox OnChange

N

n777krish

Hello All,

I have added a Combobox through code onto a new group on the RibbonX
in Outlook 2007.

I am finding a problem with the Combobox when the ribbon is minimized.

On the Combobox_OnChange callback, I am putting a messagebox as
"Msgbox "Test"".
When I change the combo box this message does not come up.

Now, If I put two message boxes as follows:
Msgbox "Test"
Msgbox "Test 1"

what I find is that the First messagebox never shows up but the second
one does.

If I put three message boxes then the second two show up but the first
one for some reason does not.

This only happens when the Ribbon is minimized.
I am testing this on Outlook 2007 B2TR.

Any ideas any one?

Another problem that I am facing is that, when I drag my Group onto
the QuickAccess Toolbar.
When the group is on the QAT I find that if the ribbon is minimized
and I change the selection on the combobox it does not get updated on
the RibbonX when I maximize it. It updates ok the Ribbon is maximized.
But here another problem occurs that when I change the selection from
the Ribbon it is not updated on the QAT.

Any pointers on this?

I would appreciate any help.
Regards,
Neil Goundar.
 
K

Ken Slovak - [MVP - Outlook]

How are you doing this, VB 6? Have you tested this at all with the RTM
version of Outlook 2007? I wouldn't even bother with any of the beta
versions at this point.

Can you show the code and XML you are using so someone else can test this?
 
N

n777krish

Hello Ken,

Thank you for your reply.

I will get the latest version of Outlook 2007 tomorrow and test this
and get back to you on this.

Thanks,
Neil Goundar.
 
N

n777krish

Hi Ken,

I have got the Trial version of Office 2007 Enterprise Edition and I
am still seeing some wierd issues.

1. The messages not showing issue seems to appear on one of Outlook's
built-in control on my machine. Could you test the following:


Compose a new e-mail. (Ensure that the Ribbon is maximized) Click in
the body of the e-mail. Go to "Message" Tab > In the Font Size combo
box Type in -85 and press enter. A message saying "The number must be
between 1 and 1638." should be displayed.

Now, Minimize the Ribbon and Carry out the same test. Go to Message
Tab > Type in -85 and Press Enter. No message comes up on my machine,
the ribbon just minimizes.

Do you get the same results? What do I do about this?

I also observe that the message box does not appear if I enter a new
item into the combo box in my addin.

2. The second problem still exists:
When I drag my Group onto the QuickAccess Toolbar.
When the group is on the QAT I find that if the ribbon is minimized
and I change the selection on the combobox on the QAT it does not get
updated on the RibbonX when I Goto the message tab where mygroup is
located. It updates ok the Ribbon is maximized.

Also I observe the following:
If the Ribbon is maximized but I have the Group on the QAT also, I
make a change in the combobox on the QAT. I close the current
inspector and open up another inspector. The Combobox on the ribbon
comes out empty but the combobox on the QAT retains the last selected
value.

I am invalidating the combobox using the IRibbonUI object on Inspector
activate. The invalidating does not seem to take effect on both of the
comboboxes.

My code structure is as follows:
When the user selects an item from the drop down
(cboProject_OnChange), a user property is added to the mailitem. This
is saved in the e-mail. The GetText function returns the value in this
property that is added to the item.

I have a designer which Implements IRibbonExtensibility. All callbacks
are defined in this designer.

The following function returns the XML that I am using (with some
unneccessary buttons removed):

Public Function GetRibbonMailCompose() As String

Dim sRibbonXML As String

sRibbonXML = "<customUI xmlns=""http://schemas.microsoft.com/
office/2006/01/customui"" onLoad=""Ribbon_OnLoad"" >" & _
"<ribbon>" & _
"<tabs>" & _
"<tab idMso=""TabNewMailMessage"" >" & _
"<group id=""QuickFile"" label=""QuickFile"">" & _
"<comboBox id=""cboProject"" label=""Project""
onChange=""cboProject_OnChange"" getText=""cboProject_GetText""
getItemCount=""cboProject_GetItemCount""
getItemLabel=""cboProject_GetItemLabel"" />" & _
"<separator id=""s2""/>" & _
"<comboBox id=""cboPrint"" label=""Print""
onChange=""cboPrint_OnChange"" getText=""cboPrint_GetText""
getItemCount=""cboPrint_GetItemCount""
getItemLabel=""cboPrint_GetItemLabel"" />" & _
"<button id=""cmdHelp"" onAction=""cmdHelp_Click""
label=""&amp;Help"" getSupertip=""cmdHelp_GetSupertip""
imageMso=""Help"" />" & _
"</group >" & _
"</tab>" & _
"</tabs>" & _
"</ribbon>" & _
"</customUI>"

GetRibbonMailCompose = sRibbonXML

End Function

I am initializing a Global IRibbonUI object on the Ribbon_OnLoad
callback which i use to invalidate the comboboxes.

Ken, Do you have any sample code in VB6.0 or any addin with combo
boxes on the ribbon written in VB6 that I could test on my machine
possibly.

Thank you for your help.

Regards,
Neil Goundar.
 
K

Ken Slovak - [MVP - Outlook]

I'll play with your code later today or tomorrow and see what I can come up
with. I have no combobox code in VB 6, VB.NET or C# for either the ribbon or
a CommandBarComboBox, I don't use those controls myself.

I can repro #1 here, I do get an error sound when the ribbon is minimized
and -85 is entered as a font size. I'd consider that a bug, but I don't
really see that many users would enter a negative number for font size.

For #2 that also sounds like a bug, but if so there's not much you can do
about it. Let me see if I can interest someone from the ribbon team in these
problems.
 
N

n777krish

Hello Ken,

Thanks for your help. I really appreciate it.

I have to clarify one point regarding what you wrote:
I can repro #1 ... but I don't really see that many users would enter
a negative number for font size.

The problem that I asked you to test was an illustration of what I am
observing in code that I have written. Because of this issue I am not
able to display any message when a users types in anything new in the
combobox. I need to be able to display a confirmation that this is
something new entered by a user then I will add it to a list that I
maintain but this message never comes up.

Thank you,
Neil Goundar.
 
K

Ken Slovak - [MVP - Outlook]

The only suggestion I can think of for that problem is a real hack. It would
be to get the hWnd of the Outlook Inspector window and place a modal dialog
window on top of that, using Win32 API calls. I think the problem is that
the parent of your message box is the ribbon frame and not the actual
Inspector window.

That could be checked and verified with some detective work using Spy++ to
see what windows are open in a window with a caption of "rctrl_renwnd32" and
see if your message box is shown in Spy++ and what window is its parent
window.

Unfortunately there will be bugs in the ribbon, some of which we know
already and some just waiting for discovery. When and if MS fixes them is
another question. However, if you have to support Outlook 2007 RTM then
there's not much you can do except try to find workarounds or come up with a
different UI design.
 
N

n777krish

Unfortunately that also does not work.

I had already tested using Windows API and trying to display a modal
dialog in front of the Outlook inspector. I get the handle to the
ForegroundWindow and try to display a dialog with same results as with
displaying Message boxes.

Even tried to display a modal form from the combobox click and it does
not get displayed.

But everything works if it comes from a Button instead of the
ComboBox. I will try SPY++ and do some detective work with that :).

Thanks for all your help. I guess in the worst case I can note this as
a known issue in our add-ins and advice customers to use it with
Ribbon maximized.

Regards,
Neil Goundar.
 
K

Ken Slovak - [MVP - Outlook]

ForegroundWindow may not be the correct window handle to use. I'd check in
Spy++ to see what's what. You want to look for a window with a class of
"rctrl_renwnd32" and a caption that matches the caption your Inspector has
in the first Inspector.Activate event. I usually use FindWindow myself.

According to a contact on the ribbon team at MS the first problem with the
message boxes is a known bug. In his words "the error messagebox gets eaten
as the minimized ribbon closes".

He was not able to repro the second issue with his own comboboxes.

He said that as long as the onChange callback caches the value entered by
the user, and getText returns that value, the combo's are always in sync.
The control referenced in the onChange and getText callbacks should always
refer to the same value to ensure the combo's are in sync.
 

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