2008 06 08Double and Triple Click
OK, that's pretty stupid :) but I had trouble figuring out what part of Cocoa handled double clicks. Turns out there's a
clickCount
message in NSEvent
that will do just that.
Compared to Javascript :
JS | ObjC | |
mouse down | onmousedown | mouseDown |
mouse up | onmouseup | mouseUp |
click | onclick | mouseUp, check [event clickCount]==1 |
double click | ondblclick | mouseUp, check [event clickCount]==2 |
triple click paragraph selection | - | mouseUp, check [event clickCount]==3 |
clickCount
also lives for mousedown, so you can check things like triple mouse down. No great use I suppose but it's there.