• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OpenGL & Cocoa NSEvents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >OpenGL & Cocoa NSEvents (From: Aaron Boothello <email@hidden>)

  • Prev by Date: Re: Examples of applications developed with Cocoa?
  • Next by Date: Re: Non-activating panel not working
  • Previous by thread: OpenGL & Cocoa NSEvents
  • Next by thread: Best app location for general exception handler?
  • Index(es):
    • Date
    • Thread