|
Eranga Weeraratne
Posts: 50
Joined: 2011-10-19
|
Hi,
When I add ADX Ribbon Checkbox to an Outlook Mail type Inspector window and when I open multiple windows, I notice that checked or unchecked is common to all the Inspectors windows. I.e. when I uncheck in one window, it unchecks in all the windows.
Is it possible to have this check/uncheck to work on the current active inspector only?
Thanks in advance,
- Eranga |
|
Posted 12 Dec, 2011 01:45:29
|
|
Top
|
|
Eugene Astafiev
Guest
|
|
Posted 12 Dec, 2011 02:31:51
|
|
Top
|
|
Eranga Weeraratne
Posts: 50
Joined: 2011-10-19
|
Hi Eugene,
Thanks for the advice. I managed to get the checkbox to work correctly within the Inspector.
There's one more request. In my Inspector, there's an ADX Outlook Form in the TopSubpane. I need to make it visible/invisible based on this checkbox state. How do I know the corresponding Form Instance for a given Inspector?
Tks,
- Eranga |
|
Posted 12 Dec, 2011 04:52:06
|
|
Top
|
|
Eugene Astafiev
Guest
|
|
Posted 12 Dec, 2011 05:16:03
|
|
Top
|
|
Eranga Weeraratne
Posts: 50
Joined: 2011-10-19
|
Hi Eugene,
I was already trying to do a similar method you mentioned. However, when the form is Invisible, the InspectorObj is not set. So, if there're multiple Inspectors, which currently has this Form in Invisible state, this method doesn't work to identify the exact form of an inspector. Is it always set to you?
Tks,
- Eranga |
|
Posted 12 Dec, 2011 06:04:09
|
|
Top
|
|
Eranga Weeraratne
Posts: 50
Joined: 2011-10-19
|
In other words, hiding the Form works, but not making it Visible.
Tks,
- Eranga |
|
Posted 12 Dec, 2011 06:05:21
|
|
Top
|
|
Eugene Astafiev
Guest
|
Hi Eranga,
For showing an ADXOlForm in one of the inspector layouts please do the following things:
1. Enable the Visible property at design time.
2. Use the following code in the AddinExpress.OL.ADXOlForm subclass for hiding it at startup:
public bool enabledVisibleForInspector = false;
private void ADXOlForm1_ADXBeforeFormShow()
{
if (!enabledVisibleForInspector)
{
if (InspectorObj != null)
Visible = false;
}
}
3. In the public add-in module sub please set the enabledVisibleForInspector property of the form to true.
4. Then you can use the http://www.add-in-express.com/forum/read.php?FID=5&TID=10217 for showing the form (call form.Show() instead of setting the Text property). |
|
Posted 12 Dec, 2011 07:00:42
|
|
Top
|
|
Eranga Weeraratne
Posts: 50
Joined: 2011-10-19
|
Hi Eugene,
Thanks for your explanation, but still it did not work for me. The main issue is when the form in Invisible, the InspectorObj is not set, so the reverse mapping of Inspector to the corresponding Form was not possible.
However I did a small hack to save the InspectorObj to a custom variable inside the Form in the 1st call to ADXBeforeFormShow event. So, in the for loop, instead of comparing Form.InspectorObj against the current Inspector, I compare against that custom variable and it works fine now.
Any loopholes of this method that you can think of?
Tks,
- Eranga |
|
Posted 13 Dec, 2011 01:02:06
|
|
Top
|
|
Eugene Astafiev
Guest
|
Hi Eranga,
Please note that the InspectorObj property returns an instance of the Inspector class (a COM object). As you may probably know you need to release it. A better solution is to save an inspector window handle in a local variable of the ADXOlForm class. For example, I have tested the following code on my PC with Outlook 2010 x64:
public bool enabledVisibleForInspector = false;
public IntPtr inspectorHandle = IntPtr.Zero;
private void ADXOlForm1_ADXBeforeFormShow()
{
if (!enabledVisibleForInspector)
{
if (InspectorObj != null)
{
inspectorHandle = MyAddin62.AddinModule.CurrentInstance.GetOutlookWindowHandle(InspectorObj);
Visible = false;
}
}
}
And in the add-in module class I used the following code for showing an instance of the ADXOlForm class:
foreach (AddinExpress.OL.ADXOlFormsCollectionItem item in adxOlFormsManager1.Items)
{
if (item.InspectorLayout == AddinExpress.OL.ADXOlInspectorLayout.RightSubpane)
{
for (int i = 0; i < item.FormInstanceCount; i++)
{
AddinExpress.OL.ADXOlForm form = item.FormInstances(i);
if ((form as ADXOlForm1).inspectorHandle == GetOutlookWindowHandle(OutlookApp.ActiveInspector()))
{
(form as ADXOlForm1).enabledVisibleForInspector = true;
form.Show();
}
}
}
} |
|
Posted 13 Dec, 2011 05:00:20
|
|
Top
|
|
Eranga Weeraratne
Posts: 50
Joined: 2011-10-19
|
Hi Eugene,
Works perfectly.
Tks,
- Eranga |
|
Posted 13 Dec, 2011 06:08:15
|
|
Top
|
|