I have a single click listener and a double click listener. I want to differentiate the different types between a single click and a double click so that I can guarantee that a piece of code doesn't execute during the wrong event and fail. Please let me know. So far the difference between the two that I have is evt.type = "click" and evt.type = "MSPointerUp"<-- What I receive during a double click event. Being that this type seems to be Microsoft specific, I would like to know the other types that are out there for the different browsers for the double click event type. If there is a universal type that I can check for please let me know. Your help would be greatly appreciated on this.
Thanks!!!
Andy,
Why not use a specific event handler function for each? This would be a more standard practice.
on(map, "click", lang.hitch(this, singleClickHandler)); on(map, "dbl-click", lang.hitch(this, doubleClickHandler));
Thanks for replying!!
The reason why I can't use a different one for each is due to the execution order of the selectTasks and queryTasks. When I attempted to have two different listeners but tried to run the same piece of code, The code I wanted to be ran first (The function that handles the selectTask execution event) would run after the unique code completed which would result in the last selected polygon being excluded from the results.
Andy,
I am not sure I understand your issue.
You could launch a new function from both handlers with a property that tells which it came from.
on(map, "click", lang.hitch(this, function(evt){ onClickHandler(evt, "single"); }); on(map, "dbl-click", lang.hitch(this, function(evt){ onClickHandler(evt, "double"); });
and now that you know which event it came from you handle it differently.
I was being a bit stubborn against duplicating code but I figured it out by utilizing what you said. I just had to replicate the same code twice and make the tweak to it for it to work. Thanks for the answer!!!!
Andy,
Glad to help. Don't forget to mark this thread as answered. To do this you have to open the thread (you can not see the correct answer link from inside your inbox) and then you will see the green star with correct answer link. Just click that link on the thread that answered your question.