ControllerMate (part 6 of 14). One Button, Two Actions: Single Click (recognized on release) versus Double Click
Note: this is not a substitute for the original and most excellent ControllerMate tutorial. I am endeavoring to save some time for those who have read it and now are eager to get things done.
Important: I strongly recommend that for the duration of this adventure you find and connect an extra mouse to your Mac – that way even if you mis-configure your target device you will still have full control.
In some designs it may become important to register the single click at the point of release, not at the moment you press. This way you can use the mouse button to drag-select multiple objects and then on release execute an action.
A fairly simple modification of an earlier algorithm achieves the result: