Jump to content
  • Advertisement
Sign in to follow this  
BeanDog

[.net] Preventing multiple OnSelectionChanged in ListViews

This topic is 4588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In ListViews, the defined behavior is that an OnSelectionChanged event is raised for each item that becomes selected or unselected. This is a problem for my application, because I hit the network each time they select something new in the list. If they highlight fifty items and then click somewhere, I end up doing fifty round-trips on the network when I only want to do one (for the final state of the listview). So the question is, what's the standard workaround? I only want one event. ~BenDilts( void );

Share this post


Link to post
Share on other sites
Advertisement
I would associate some sort of variable within the form that acts as a control switch. You could use an int or a bool that changes or increments when the user fires the event handler. It would check the state of that variable and proceed accordingly.

Another option would be to not use that event at all. Add a button to the form that acts as a confirmation. When the user clicks ok, grab the text (or whatever data you want) from the selected item in the listView control and send your data.

Hope this helps.

Share this post


Link to post
Share on other sites
I have to agree with Etherstart: Add a button. It's smart to have a user confirm before accessing the network, esp. in cases where the user must either wait very long OR when alot of data needs to be transmitted.

Toolmaker

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!