C# Winform - Detecting whether two events were fired by one user action -


i have winform's combobox, , of course need know when user chooses option. problem each event type has disadvantage:

textchanged doesn't fired when choosing happens closed drop down list (but focusing combobox , moving , down keyboard arrows).

selectionchangecommittedhandler isn't fired when drop down list open, user goes , down keyboard arrows , click mouse either on combobox title or outside.

slectedindexchangedhandler fired times slow program in cases of weak web connection.

so thought solution:

register both selectionchangecommittedhandler , textchanged events , in cases both fired, ignore 1 of them. problem don't know how detect situation (= 2 events 1 user action).

i'd glad know how detect that, or, if there, hear better solution.

a bit dirty, i'm trying give solution: listen both events , mark timestamp each time 1 of them fires. once event fires, check current time vs last operation time and, given tolerance you'll decide, continue program logic if amount of time elapsed since last operation.

i imagine around 100 milliseconds suffice try yourself.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -