Inspector command bars doubt

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

Inspector command bars doubt
 
Esteban Astudillo


Guest


Hi Sergey,

I was hoping you could shed some light on this confusion I?Â?Ð?ém having with the way ADX handles Inspector command bars.

I?Â?Ð?éve looking at your sample project ?Â?Ð?ìOlDynCommandBars?Â?Ð?í where you create two ADXOlInspectorCommandBar command bars at design time and use the InspectorActivate event to show one or the other depending on if this is a new email or an existing one.

Looking at that example what I don?Â?Ð?ét understand is how ADX handles events for the command bar buttons when I have opened two different Inspectors at the same time (I open two email items from the Explorer). Does ADX create a unique instance of the ADXOlInspectorCommandBar object for each Inspector created or it just ?Â?Ð?ìassigns?Â?Ð?í the only one instance to both Inspectors?

If there is only one instance of the command bar shared by the two Inspectors, how ADX handles simultaneous events? For example, say that in the OnClick event of one of the buttons I have a lengthy operation and the user has two Inspectors open and clicks on the button on each Inspectors very quickly (almost ?Â?Ð?ìsimultaneously?Â?Ð?í)

I was reading the PDF documentation but I couldn?Â?Ð?ét find this type of information in that doc . I hope you can help understand how ADX works.

Thanks a lot
Posted 09 Mar, 2006 10:59:53 Top
Sergey Grischenko


Add-in Express team


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

ADX creates only one instance of each command bar. The fact is that only one inspector can be active at the same time.
ADX reconnects command bars/controls whenever a new inspector has been activated. It happens very quickly.
Posted 09 Mar, 2006 18:44:05 Top
Esteban Astudillo


Guest


I understand. In that case, can you help me with this related question?

I?Â?Ð?ém sure there has to be a simple solution for this, but I can?Â?Ð?ét figure this out. How can I get a reference to the Inspector and MailItem objects from within the event handler for a CommandBarButton?Â?Ð?és Click event?

Is it clear enough? In the button's event handler I need to reference the corresponding MailItem and Inspector objects to do some specific actions.

Thanks!
Posted 09 Mar, 2006 18:55:48 Top
Esteban Astudillo


Guest


I found the solution looking at one of your samples:

Outlook._Inspector inspector = OutlookApp.ActiveInspector();

Is that it?
Posted 09 Mar, 2006 18:56:55 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Yes, correct.
Posted 09 Mar, 2006 19:00:18 Top
Esteban Astudillo


Guest


Hi Sergey,

I have another question in the same subject. I understand that ADX creates only one instance of the toolbars and buttons and that it dynamically assigns them to the corresponding Inspector when they are activated.

I'm comfortable with the behaviour and I use it quite a bit.

However, I also have one case where I need to make a distinction between the two instances of the Inspector's toolbars. In my case, I'm changing the Icon of the button of one ADXOlInspectorCommandBar toolbar I created according to some user selections. If the user has two Inspector windows opened and triggers the action that changes the icon, both windows are updated simultaneously.

Thus, it's clear to me that in this case I need to create a new toolbar on the fly in the NewInspector event and assign it to the Inspector object, so that they really are independent instances.

I do know how to do this (I have built another add-in prior to purchasing ADX), but I'm concerned with how I should do this in a way that continues to be compatible with ADX, or at least that it doesn't cause a problem to what ADX is controlling. So, the question is if you have had to deal with a similar case in the past? If so, do you have some recommendations or sample code on how to do this safely?

I still would like to continue taking advantage of all the benefits ADX provides, but I also need to support this special case.

Can you give me a hand with this?
Posted 13 Mar, 2006 21:07:28 Top
Sergey Grischenko


Add-in Express team


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

Thus, it's clear to me that in this case I need to create a new toolbar on the fly in the NewInspector event and assign it to the Inspector object, so that they really are independent instances.

In this case all independent toolbars should also have the unique name.

I do know how to do this (I have built another add-in prior to purchasing ADX), but I'm concerned with how I should do this in a way that continues to be compatible with ADX, or at least that it doesn't cause a problem to what ADX is controlling

There are two events that you can use: NewInspector and InspectorActivate. ADX is contolling all command bars before these events are fired. After this you can manipulate command bars/controls as you like.

So, the question is if you have had to deal with a similar case in the past? If so, do you have some recommendations or sample code on how to do this safely?

I haven't been asked about this issue before. The Office Object Model is flexible but it also has some certain restrictions. Did you try to find another solution to implement your idea?
Posted 14 Mar, 2006 19:13:29 Top
Eugene Starostin


Guest


Hello Esteban,

My two cents...

Thus, it's clear to me that in this case I need to create a new toolbar on the fly in the NewInspector event and assign it to the Inspector object, so that they really are independent instances.


To my mind it is no good idea. Try to disable your inspector command bar or hide some controls for all unfocused inspectors and enable/show all you need on the active inspector. What do you think about this?

In any case, give us more detailed information about your project via the forum or e-mail.
Posted 14 Mar, 2006 19:36:35 Top
Esteban Astudillo


Guest


Interesting concept Eugene, thank you for that. I will check with my users if a change like that would be reasonable.

Most importantly I really appreciate the kind of comments like not recommending adding/removing the toolbar dynamically. I'm sure if you are saying it is because you are aware of all the problems involved with it. If my users force me to have independent toolbars I may need your advice again on what sort of problems I should expect.

Thanks
Posted 14 Mar, 2006 20:04:43 Top
Eugene Starostin


Guest


Hello Esteban,

My experience shows that Outlook is a very gentle host. So, I would avoid mass dinamic changing of its command bar system at run-time.
Posted 15 Mar, 2006 11:40:56 Top