[Outlook] Multiple contact screens with bar

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

[Outlook] Multiple contact screens with bar
Some question on how te update multiple bars. 
Wim W.A. ten Brink


Workshop Alex


Posts: 30
Joined: 2005-11-23
I have another issue. I am using a TadxOlInspectorCommandBar with only adxOLContact so this bar will appear on the contact forms of Outlook. This works fine.
My bar responds from events generated by the system. These events will change the captions of this bar and even enable/disable or show/hide buttons. But these changes must be shown on all open contact forms. This just doesn't happen.

Example: I open contact 'Anna' and I see a bar with a 'Dial' button. I then open contact 'Betty' and this contact also gets a 'Dial' button. I then click on the 'Dial' button of Betty, initiating a phonecall. As a result, the 'Dial' button on Betty is disabled. But I also need the 'Dial' button on Anna to be disabled since I can only call one person at one time.

So the problem is that two contacts are opened yet my code to update the bar only updates the bar of one contact. Is there a way to fix this?

Some sample code:

// Type definition.
type
TAddInModule = class( TadxCOMAddInModule )
adxOlInspectorCommandBarContact: TadxOlInspectorCommandBar;
private
olButtonDialContact: TadxCommandBarButton;
protected
... Some more stuff.
end;

// Code to get faster access to the Dial button.
procedure TAddInModule.adxCOMAddInModuleAddInInitialize( Sender: TObject );
begin
olButtonDialContact := adxOlInspectorCommandBarContact.Controls[ 0 ].AsButton;
end;

// Event that gets fired when a call is made.
procedure TAddInModule.CmdDial( Sender: TObject );
begin
olButtonDialContact.Enabled := False;
end;

After this code, I open contacts Anna and Betty and trigger the CmdDial event. The Dial button on Betty is disabled yet the Dial button on Anna is still enabled. I hoped they would both be disabled.
With kind regards,
\/\//\ Workshop Alex
Posted 01 Dec, 2005 10:20:22 Top
Dmitry Kostochko


Add-in Express team


Posts: 2799
Joined: 2004-04-05
Hi Wim,

This is a feature of the Outlook inspector window. The point is separate instances of Command Bars are created for each instance of the Inspector window. I can suggest you to handle the OnInspectorActivate event and disable/enable your controls there. Or not to disable them at all but rather show a dialog box with a warning message like "You can call one person at one time".

Posted 01 Dec, 2005 10:50:23 Top
Wim W.A. ten Brink


Workshop Alex


Posts: 30
Joined: 2005-11-23
Hi Dmitry,

I was already afraid for that and will just have to write my own code just do detect and all the command bars to keep them all up-to-date. Means walking through all inspectors, fiding my bar on them, finding the button that needs to be altered and then altering them.

I was kind of hoping that the Add-In already had some functionality that does this and that I just missed it. :)

The messagebox solution won't work, though. One of the buttons has a caption displaying the status of the phone at that moment. If there's a call, it displays the caller-ID. And it's shown on every contact form too so perhaps it's not the right place to put that button there. I could alter it but it means changing the whole functionality of the things that I already have. And am running a bit out of time here.

So far tests have shown that the components work real well. Tomorrow my Outlookbar will be shipped to my clients and it's up to them to decide if they are bothered by this or not.

If they are, I'll have more hours of work to do. Glad I'm paid by the hour. ;)
With kind regards,
\/\//\ Workshop Alex
Posted 01 Dec, 2005 12:24:06 Top
Dmitry Kostochko


Add-in Express team


Posts: 2799
Joined: 2004-04-05
Hi Wim,

Yes, you can write a code to loop all opened inspectors, detect your button and change it. I don't think it is really difficult, but if you need our help with this, just let me know and I will create an example for you.

Posted 02 Dec, 2005 07:24:46 Top
Wim W.A. ten Brink


Workshop Alex


Posts: 30
Joined: 2005-11-23
Hi Dmitry,

I can do it. It's not that difficult. However, it might be an interesting suggestion for a next version of the Afalina bar to allow changes to these bars to be just the last instance or to to all the instances of this bar.

It would just be nice additional functionality if it could update all the bar instances.
With kind regards,
\/\//\ Workshop Alex
Posted 02 Dec, 2005 08:59:11 Top
Dmitry Kostochko


Add-in Express team


Posts: 2799
Joined: 2004-04-05
Hi Wim,

Thank you for the idea. We will discuss it.

Posted 02 Dec, 2005 09:19:14 Top