ADXSelectionChange-multipilcation

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

ADXSelectionChange-multipilcation
 
BerndH




Posts: 99
Joined: 2014-09-23
Hi,
I have a small test-app. It has a form manager with a form. I log the adxselectionchange-event of this form.
If I run the app and select another mail, I get one line "adxselectionchange"in my log. Thats what I expect.

If i click quickly through the "outlook-empire", stop and then click a mail... I get lots of log-entries "adxselectionchange" although I just clicked one mailitem. That are much more lines than I expect.

What?s my failure ??? How can I prevent this ?

Bernd
Posted 18 Nov, 2021 17:38:28 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Bernd,

Outlook generates that event, not Add-in Express. Say, you get the event if you click the same Outlook item several times. Accordingly, you have to live with this.

With multiple events on the same item, you should know whether the item has been processed: compare the EntryId of the selected item with the EntryId of the item last processed.

There's one more scenario: you select an item, press {DOWN ARROW}, wait while it scans through several emails and release the key. In this case you may get a whole lot of events and only the last one is meaningful.

You solve this using a timer that fires its event on the main thread. I recommend using a System.Windows.Forms.Timer. Experiment with Interval property: set it e.g. to 200-500 ms.

In the event handler of the SelectionChange event, you check the timer: if it isn't started, you start it; if it is started, you stop and restart it. When the timer fires its event, you get the selection and process it.

As to
BerndH writes:
If i click quickly through the "outlook-empire"


I'm not sure that I understand you.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Nov, 2021 04:36:28 Top
BerndH




Posts: 99
Joined: 2014-09-23
Hi,
that means: I click some mail items after another, change folders, click some mails in other folders.
Then I stopp "click quickly through my mails".

I clean my log.
I click one mail and then I got lots of adxselectionevent-loglines after I do one klick on a mail.

This happens also, if I wait some minutes...

--> n.b.: only the adxselectionevents from the adxolform "grow up"

--> every mailfolder you click (and you haven?t selected before) causes a adxselectionevent more
Posted 19 Nov, 2021 05:48:32 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Bernd,

I'm sorry for the delay; we are busy with releasing the next Add-in Express version.

The issue is caused by Add-in Express invoking that event handler for all instances of the task pane. Since you have ADXOlFormsCollectionItem.Cached set to NewInstanceForEachFolder (default), the number of forms increments when you navigate to a new folder. What adds to the issue is Add-in Express not checking whether the form instance is visible or not; unfortunately, this old-time mistake cannot be fixed because of compatibility reasons.

You have two ways to bypass the issue:
- set ADXOlFormsCollectionItem.Cached to OneInstanceForAllFolders
- in the event handler, ignore the call if this.Visible is false

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Nov, 2021 09:45:50 Top
BerndH




Posts: 99
Joined: 2014-09-23
Yes, that works for me.

I'll come back with another problem :-)

Thank you.
Bernd
Posted 25 Nov, 2021 05:10:46 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Bernd,

Welcome!

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2021 08:24:50 Top