NSButton Up/Down Events

Brad Carter bcarter at mac.com
Fri Feb 9 10:25:32 PST 2007


yes, I think I wasn't explaining what I wanted correctly.

I need this for the button down, not mouseDown.  I think I was stuck  
on the thought of using mouseDown because that's how I got it to work  
in AppleScript Studio.  So, on button down I call a method and then  
when the button is released it calls another method.

Here's an example of a mouseDown I did using AppleScript and it also  
has an 'on mouse up' section that basically does the same thing.

on mouse down theObject event theEvent
	if the name of theObject is equal to "panLeft" then
		do shell script "/usr/bin/curl --connect-timeout 2 http://admin: 
12345678 at 10.160.101.12/SetIO?p61=0 > /dev/null 2>&1 &"


On Feb 9, 2007, at 10:33 AM, Shawn Erickson wrote:

>
> Oh I may have misread what you asked above... by "button" did you mean
> mouse button or user interface button?
>
> The reference documentation I linked earlier covers both questions but
> in case of the former...
>
> mouseDown:, mouseDragged:, and mouseUp: only happens if the "left"
> (primary) mouse button is clicked. So you don't need to check event
> type... getting the message implies that the primary button was
> clicked.
>
> rightMouseDown:, rightMouseDragged:, and rightMouseUp: only happen if
> the "right" (secondary) mouse button is clicked.
>
> All other buttons that the mouse may have come in via otherMouseDown:,
> otherMouseDragged:, and otherMouseUp: messages and you would check
> [event buttonNumber] to know which button on the mouse was clicked.
>
> Finally note that scroll wheel events come in via scrollWheel:.
>
> -Shawn



More information about the MacOSX-dev mailing list