Reading the value of a CommandBarDropDownList

Add-in Express™ Support Service
That's what is more important than anything else

Reading the value of a CommandBarDropDownList
 
Sander Hagendoorn




Posts: 8
Joined: 2006-12-04
Hi,

I've almost finished my outlook plugin, but there is one issue I can't seem to get my head around.

I've got a commandbar in the new mail window which contains a dropdownlist.
When the user sends the mail, I need to read the value of the dropdown and decide what to do based on the selection.

I've tried hooking up with the OnChange event, but I've noticed the actual event can take several seconds (up to 10?) to fire, so the user can press send way before that happens.
Next i've tried to read the value of the bar on the ProcessSend event using the following code:


AddinExpress.MSO.ADXCommandBar myBar = AddinExpress.MSO.ADXAddinModule.CurrentInstance.CommandBarByName("adxOlInspectorCommandBar1");
AddinExpress.MSO.ADXCommandBarDropDownList myCombo = (AddinExpress.MSO.ADXCommandBarDropDownList)myBar.Controls.GetControlByControlTag("c544a8b2-64e8-4705-9a42-091beacd4489", false);
listIndex = myCombo.ListIndex;


This code crashes sometimes, I suspect sometimes the mail window has already been disposed when the code runs.
Next I tried to insert the same code in the OnProperty change, but that event fires so often the code crashes just the same.

What am i doing wrong here?

Regards,
Sander Hagendoorn
Posted 15 Dec, 2006 06:45:56 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Sander.

Please try to use the Text property of the ADXCommandBarComboBox component to get the selected value.

P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 18 Dec, 2006 13:16:17 Top
Sander Hagendoorn




Posts: 8
Joined: 2006-12-04
Hi Sergey,

I followed your suggestion, but that didn't solve the problem.
I've now tracked down the problem to a form being displayed during the Send event. The designer code for this form (InitializeComponent()) contains the following line:
this.adxAddinInstaller1 = new AddinExpress.MSO.ADXAddinInstaller();

When that line is commented out, the addin seems to work fine, although I don't feel secure with hacking the designer's generated code.

Any thoughts on the subject, or recommended practices?
Btw, why did you suggest using the text property instead of the selectedindex?

Regards,
Sander
Posted 19 Dec, 2006 05:48:31 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Sander.

Why do you use the ADXAddinInstaller class in the add-in? The fact is that the class is not designed to be used from the add-in. Please remove this component from the form.
I suggested the Text property because it was updated by the host application immediately when you selected an item in a combo box.
Posted 19 Dec, 2006 11:06:42 Top
Sander Hagendoorn




Posts: 8
Joined: 2006-12-04
Hi Sergey,

The component doesn't show up on the form, it's only in the designer generated code.
Judging by your reaction, it's probably some VS mixup. I did have some troubles with the designer code after installing the latest update to VS.
I'm hoping this is not reproducable...

Thanks for explaining about the Text value, that's crystal clear ;)

Regards,
Sander
Posted 19 Dec, 2006 11:31:35 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Sander, if the component doesn't show up on the form, you can delete it manually without any problems (don't forget to close the form designer before).
Posted 19 Dec, 2006 11:58:48 Top