ListSelector gets confused when multiple objects are added (ctrl click) and loading data takes a long time

I have a list selector that allows selection of which plots to be displayed out of a total of 4 plots. Once I click on one of the objects in the selection, this triggers an update of the plots shown.

When I select multiple objects (), it generates confusion as the first click sends off the program to go fetch the data and create the selected plot and then the second click does highlight the clicked item but it does not seem to trigger another call to the function to go and show that plot as well - so some kind of a race condition. This results in the selected items in the list selector to be out of sync with the actual plots shown (2 selected in the file selector but only 1 shown).

So, how can I resolve this? Some elements that come to mind:
a. can I wait to see if there are multiple clicks?
b. can I show an hourglass to indicate the program is doing work?
c. how can I keep the list selector and plots shown in sync?

a. can I wait to see if there are multiple clicks?

You could add a button which triggers the event you want.

b. can I show an hourglass to indicate the program is doing work?

You should be able to trigger some action before your callback gets started, e.g. adding a spinner of some kind.

c. how can I keep the list selector and plots shown in sync?

If what you’re describing is accurate then that sounds like a bug, they should eventually be consistent, i.e. after the first event is done a second event should be triggered with the full selection.

Thank you for the fast replies.

Let me try and submit a stylized version of my code that reproduces this.

1 Like

I have tried to make a stylized version and so far failed to reproduce this in simpler code than my overall code. In that code, I have added a button, so that takes care of this.

I have now tested my overall code again by modifying it so that changing the ListSelector triggers a graph update without using the button. And it works without a problem although with some delay. Maybe I just did not wait enough last time, not sure. In any case, thank you for your help. I will continue to use the version with the button.