Posts 1 - 10 of 12
First | Prev. | 1 2 | Next | Last
|
|
Patrick Jox
Guest
|
Hello,
I have an Outlook form with four adxOlForm items each displayed in inspector region. In one form there is a GUI to adminstrate a list of unit items. These Items shall be used on a second form to populate a comboboy (for lookup).
"Units" is a public property of first form. How can I access it from the second one?
Kind regards
Patrick
|
|
Posted 05 Aug, 2009 15:10:32
|
|
Top
|
|
Eugene Astafiev
Guest
|
|
Posted 06 Aug, 2009 07:19:47
|
|
Top
|
|
Fedor Shihantsov
Guest
|
Hello Patrick,
Use the adxOlFormsCollectionItem.FormInstanceCount prperty and the adxOlFormsCollectionItem.FormInstances(i) method.
Say, in the following way: (adxOlFormsCollectionItem.FormInstances(i) as MyAdxOlForm).Units |
|
Posted 07 Aug, 2009 09:57:31
|
|
Top
|
|
Patrick Jox
Guest
|
Sounds good. But where do I get the adxOlFormsCollectionItem from?
As far as I see, the addinModule exists as single instance in the whole application and so there is one singel formsmanager too which has an items collection. But where / how can I access the real instances of a form.
Maybe I am blind or it's because of the sunday?
Kind regards
Patrick |
|
Posted 09 Aug, 2009 14:25:38
|
|
Top
|
|
Patrick Jox
Guest
|
OK. I found the adyOlFormsCollectionItem in my addinModule. So using the IdentifyTheForm-Sample I can find the current index of the active form. Normally this should be the same index in the other form I want to access.
Is this the way I have to work?
Sounds a bit complicated and not really sure? Is this a good way?
Kind regards
Patrick |
|
Posted 09 Aug, 2009 14:51:45
|
|
Top
|
|
Fedor Shihantsov
Guest
|
Patrick,
I do not recommend you using the same index. Use the sample solution.
You can compare ADXOlForm.CurrentOutlookWindowHandle properties instead of using the same index. |
|
Posted 10 Aug, 2009 08:24:02
|
|
Top
|
|
Patrick Jox
Guest
|
But how can I access form1 (which is currently not shown) from within form2 (which is currently active / visible). the currentOutlookWindowHandle will be the one of form2 so how should I recognize the good instance of form1?
Regards
Patrick |
|
Posted 10 Aug, 2009 09:46:08
|
|
Top
|
|
Fedor Shihantsov
Guest
|
Please see the code below from the
http://www.add-in-express.com/support/addin-c-sharp.php#form-regions howto.
public AddinExpress.OL.ADXOlForm InactiveForm()
{
for (int i = 0; i < adxOlFormsCollectionItem1.FormInstanceCount; i++)
{
if (adxOlFormsCollectionItem1.FormInstances(i).Visible
&& !adxOlFormsCollectionItem1.FormInstances(i).Active)
{
return adxOlFormsCollectionItem1.FormInstances(i);
}
}
for (int i = 0; i < adxOlFormsCollectionItem2.FormInstanceCount; i++)
{
if (adxOlFormsCollectionItem2.FormInstances(i).Visible
&& !adxOlFormsCollectionItem2.FormInstances(i).Active)
{
return adxOlFormsCollectionItem2.FormInstances(i);
}
}
return null;
}
Please let me know if you have other questions or if my answers were not sufficient for you. |
|
Posted 10 Aug, 2009 10:26:03
|
|
Top
|
|
Patrick Jox
Guest
|
Sorry I do not really see the advantage of this.
You iterate through the FormInstances and return the first one which ist visible but not active. But how can I find out that this is the one of my currently visible outlook item?
Since adxOlFormsCollectionItem is hosted in the add-in there is no reference to the outlook item that instanced the form.
Oh this brings me to the idea to enhance the forms to have a property for the Outlook.ContactItem.EntryId which could be set during OnLoad of the form.
I will give it a trial.
Kind regards
Patrick
|
|
Posted 11 Aug, 2009 13:13:16
|
|
Top
|
|
Fedor Shihantsov
Guest
|
Well, assume you have two adxOlFormsCollectionItems. ADXOlForm1 corresponds to adxOlFormsCollectionItem1. ADXOlForm2 corresponds to adxOlFormsCollectionItem2.
Currently ADXOlForm2 shows up in an Inspector. It is visible and active.
ADXOlForm1 shows up in an Inspector, it is visible but not active (I.e. it is located under ADXOlForm2).
Task: Need to find ADXOlForm1 in the same Inspector where ADXOlForm2 is located.
Solution:
//ADXOlForm2 code
public void Test()
{
ADXOlForm1 form = (this.AddinModule as AddinModule).FindForm(this.CurrentOutlookWindowHandle);
}
//AddinModule Code
public ADXOlForm1 FindForm(IntPtr CurrentOutlookWindowHandle)
{
for (int i = 0; i < adxOlFormsCollectionItem1.FormInstanceCount; i++)
{
if (adxOlFormsCollectionItem1.FormInstances(i).Visible
&& !adxOlFormsCollectionItem1.FormInstances(i).Active
&& CurrentOutlookWindowHandle == adxOlFormsCollectionItem1.FormInstances(i).CurrentOutlookWindowHandle
)
{
return adxOlFormsCollectionItem1.FormInstances(i) as ADXOlForm1 ;
}
}
return null;
}
Will that do? |
|
Posted 12 Aug, 2009 08:49:20
|
|
Top
|
|
Posts 1 - 10 of 12
First | Prev. | 1 2 | Next | Last
|