Re: OpenGL & Cocoa NSEvents
Re: OpenGL & Cocoa NSEvents
- Subject: Re: OpenGL & Cocoa NSEvents
- From: Robert Goldsmith <email@hidden>
- Date: Mon, 20 Jan 2003 00:31:54 +0000
>
this is the decleration for handling mouseDown events.
>
>
- (void)mouseDown:(NSEvent *)theEvent;
>
>
it only responds to left-mouse Down, i would like to be able to detect
>
right-mouse clicks.(refering to NSEvent type, and it only responds when
>
type = 1 (ie:leftmousedown))
If you look at the NSResponder class (which any class that accepts
events must subclass - such as NSView), you will notice there is a
mouseDown, rightMouseDown and otherMouseDown event. Furthermore, there
is a keyDown event which informs you of key presses. If you want to
know whether a modifier key (such as control or shift) was pressed at
the time of the event, take a look at NSEvent's modifierFlags method
which returns a bit mask you can use to check for them.
One other point you may not be aware of is that, by default, subclasses
of NSResponder do NOT accept any events but mouse events. To receive
these events you need to overload the NSResponder method
acceptsFirstResponder (just get it to return YES). If you want to know
when your subclass has become the first responder, overload
becomesFirstResponder. By default this just returns YES but you can use
it to refuse first responder status or do stuff before you accept
firstResponder status.
Robert
---
GnuPG public key:
http://www.Far-Blue.co.uk/RSGoldsmith.asc
[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.