Code to detect single or double click

I disagree. Somewhere back there was an explanation of that. It's the application layer that is supposed to direct the commands to the appropriate actions. For example, if I click on an icon, it becomes highlighted immediately. If I double click on an icon, it is first immediately highlighted, then launches on the second click. The UI or application is not supposed to present double click actions that don't transition through a single click response first.

After a single click input is detected, it is not possible to determine whether or not it is a double click until some interval has passed. Waiting until that interval has passed, to make a determination of single or double click type, results in sluggish response time.

So, the proper way is for the UI to supply both events, a single click and then a double click, and the application responds appropriately. To implement any input event that is linked to a double click, where the preceding single click would have undesirable side effects, would be a bad design.

1 Like