• 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: Handling keyDown events results in beeping from a NSView subclass...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling keyDown events results in beeping from a NSView subclass...


  • Subject: Re: Handling keyDown events results in beeping from a NSView subclass...
  • From: Graham Reitz <email@hidden>
  • Date: Sat, 24 May 2008 22:09:57 -0500

Excellent!   Thanks Pete!

-graham


On May 24, 2008, at 9:56 PM, Peter Burtis wrote:

Add the method -(BOOL)acceptsFirstResponder { return YES; } in the custom and it will work as desired. By default, just clicking on an custom NSView *doesn't* make it the first responder, and keyboard events are sent to the first responder and then up the responder chain, unlike mouse events which are sent to the actual object clicked.

-Pete

On May 24, 2008, at 10:37 PM, Graham Reitz wrote:


1) Create a simple Cocoa application
2) Open IB and drag a Custom View over to the Window
3) Name the Custom View class
4) Write the class files and add them to the project
5) Derive a class from NSView and implement the keyDown method.
- (void)keyDown:(NSEvent *)theEvent;
6) Run the program and hitting a key on the keyboard results in a beep with no call to the key Down method.


What am I missing?

Mouse events come through without any issue.

thanks,
-graham

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Handling keyDown events results in beeping from a NSView subclass... (From: Graham Reitz <email@hidden>)
 >Re: Handling keyDown events results in beeping from a NSView subclass... (From: Peter Burtis <email@hidden>)

  • Prev by Date: Re: File's Owner
  • Next by Date: NSTextField in NSCollectionView aborts editing without notice, solved
  • Previous by thread: Re: Handling keyDown events results in beeping from a NSView subclass...
  • Next by thread: NSTextField in NSCollectionView aborts editing without notice, solved
  • Index(es):
    • Date
    • Thread