ADX X problems

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

ADX X problems
 
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Hi,

I've been working on a test project using the ADX X plugin and I'm having problems with some basic tasks. I read the PDF documentation but I couldn't find an answer to what I'm looking for.

For example:

- How can I turn ON/OFF visibility of a pane? I know about the Enabled property, but this property seems to be used only at the time of creating the Inspector window. Changing this value after the Inspector was create seems to have no effect

- How do I access the Outlook Folder Form instance from the AddinModule's InspectorActivate event code? I need to get to the actual instance to update the content according to the message opened.

- When I open two Inspectors it seems that both instances are connected. Changes in one of them are reflected in the other one. I tried using the "None" and "NewInstanceForEachFolder" for the Cache property but it makes no difference

Do you have an example showing this type of actions?

Thanks in advance

Posted 22 Nov, 2006 15:22:53 Top
Fedor Shihantsov


Guest


Hi Esteban,

- How can I turn ON/OFF visibility of a pane? I know about the Enabled property, but this property seems to be used only at the time of creating the Inspector window. Changing this value after the Inspector was create seems to have no effect

Yes, you can use the AdxOlFormsManager.ADXNewInspector event to change the form visibility using the AdxOlFormsCollectionItem.Enable property. If you set the Enable property to True when an Inspector form is open then the Inspector form will show up only after Inspector is reopened.

- How do I access the Outlook Folder Form instance from the AddinModule's InspectorActivate event code? I need to get to the actual instance to update the content according to the message opened.

To get the ADXOlForm, use the ADXOlFormsManager.CurrentForm property.
Also, you can get (and save) the reference to any ADXOlForm in the ADXOlForm.ADXBeforeFormShow event.

- When I open two Inspectors it seems that both instances are connected. Changes in one of them are reflected in the other one. I tried using the "None" and "NewInstanceForEachFolder" for the Cache property but it makes no difference

The ADX Extensions always creates a new ADXOlForm instance for every Inspector window. I.e. the Inspector ADXOlForms are not cached.
What do you mean by "reflected in the other one" (does it raise events or anything)?

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 23 Nov, 2006 05:35:53 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Hi Fedor,

Regarding visibility you said:

Yes, you can use the AdxOlFormsManager.ADXNewInspector event to change the form visibility using the AdxOlFormsCollectionItem.Enable property. If you set the Enable property to True when an Inspector form is open then the Inspector form will show up only after Inspector is reopened.


I'm sorry I wasn't clear with my question. I knew already about the Enabled property which I can set in the NewInspector event. All good here. What I really was trying to ask is how do I do the same action form say the InspectorActivate event. I thought of using the Hide method of the form, but I didn't know how to get the instance reference. You told me how to get it, so I will give it a try. But is this the recommended way?

So again, from the InspectorActivate, what is the recommended way to get the Form instance associated to that Inspector and decide to show/hide it in there?

Also, you said:


The ADX Extensions always creates a new ADXOlForm instance for every Inspector window. I.e. the Inspector ADXOlForms are not cached.
What do you mean by "reflected in the other one" (does it raise events or anything)?


What I mean is this. In my simple example I captured the NewInspector event and decided to set the Enabled property a value of true or false depending on information I collect about the mailItem. When I open a second Inspector window (leaving the first one open) and if this second Inspector sets the Enabled property to false, it also hides the form in the previously opened Inspector.

I hope I'm describing correctly what I want to say. Thank you in advance for your support
Posted 23 Nov, 2006 11:44:23 Top
Fedor Shihantsov


Guest


Esteban,

The only one way to control the visibility of ADXOlForm is using the ADXOlFormsCollectionItem.Enabled property.

But, whenever you change any ADXOlFormsCollectionItem’s properties, ADXOlFormsManager removes all forms. If you need to prevent this, you use the ADXOlFormsManager.LockUpdates and ADXOlFormsManager.UnlockUpdates methods.

So, to control the inspector ADXOlForm visibility use the ADXNewInspector event of ADXOlFormsManager, say by the following way.

private void adxOlFormsManager1_ADXNewInspector(object inspectorObj)
{
    object currentItem = (inspectorObj as Outlook.Inspector).CurrentItem;
    Outlook.MailItem mailItem = currentItem as Outlook.MailItem;
    if (mailItem != null)
    {
        adxOlFormsManager1.LockUpdates(); // prevents removing cashed forms
        if (mailItem.Subject == "MySubject")
        {
            adxOlFormsManager1.Items[0].Enabled = true;
        }
        else
        {
            adxOlFormsManager1.Items[0].Enabled = false;
        }
        adxOlFormsManager1.UnlockUpdates();
    }
}


The current version does not allow changing the inspector ADXOlForm visibility in open Inspector windows without deleting all the forms.
We will add this functionality in the next version.

There is a workaround, though. To emulate Show/Hide, you set the form size to zero.
Also you can set the ADXOlFormsCollectionItem.Splitter property to None to prevent resizing by the user.

private void adxOutlookEvents_InspectorActivate(object sender, object inspector, string folderName)
{
    ADXOlForm1 currentForm = adxOlFormsManager1.CurrentForm as ADXOlForm1;
    if (currentForm != null)
    {
        bool NeedToHide = false;

        //TODO set NeedToHide

        if (NeedToHide)
        {
            switch (currentForm.Item.InspectorLayout)
            {
                case AddinExpress.OL.ADXOlInspectorLayout.RightSubpane:
                case AddinExpress.OL.ADXOlInspectorLayout.LeftSubpane:
                    currentForm .Width = 0;
                    break;
                case AddinExpress.OL.ADXOlInspectorLayout.BottomSubpane:
                case AddinExpress.OL.ADXOlInspectorLayout.TopSubpane:
                    currentForm .Height = 0;
                    break;
            }
        }
    }
}
Posted 24 Nov, 2006 03:33:06 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Hi Fedor,

So what you are saying is that at least for this version of ADX X it's better to assume that the Form will be visible all the time in all Inspector windows and instead of trying to hide it just customize them to represent both states (using your suggestion to control the dimension of the form being one of the possibilities)

I'm OK with that as it seems like a reasonable workaround, but I'm looking forward to the new version that would allow me to control the visibility completely.

In a related note, I'm trying to use the CurrentForm property of the adxOlFormsManager instance in the OutlookEvents.InspectorActivate event (I have only one form in the collection of forms to be used by Inspector windows, by the way). The problem I'm having is that when I have more than one Inspector windows opened the CurrentForm property evaluates to NULL.

How is this possible? What should it be the recommended (safest) way to access the CurrentForm instance from within the InspectorActivate event?

Thank you for your time
Posted 24 Nov, 2006 11:16:34 Top
Fedor Shihantsov


Guest


Hi Esteban,

What Inspector type do you use (mail, contact, etc.)?
Do you use Word as the email editor?
Posted 27 Nov, 2006 04:39:11 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Hi Fedor,

I do not use Word Editor (not at this time, anyway). This is a mail Inspector.

Posted 27 Nov, 2006 13:55:41 Top
Fedor Shihantsov


Guest


Esteban,

Could you please create a test add-in with the same behavior and send it to the support email.
Posted 28 Nov, 2006 03:20:58 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Hi Fedor,

I will prepare the test project and send it you support. Thank you.
Posted 28 Nov, 2006 21:47:38 Top