• 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: NSView subclass does not seem to start
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView subclass does not seem to start


  • Subject: Re: NSView subclass does not seem to start
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 30 Dec 2013 17:05:04 -0600

Hi,

On Dec 30, 2013, at 4:34 PM, Alex Hall wrote:

> Anyway, the problem remains that I need to capture keystrokes (and eventually mouse movements) in a subclass of NSView, but nothing seems to happen.

In order for a view to receive key events, it must be the first responder.  Typically, you need to override -acceptsFirstResponder to return YES to allow a view to become the first responder.  (There are other approaches, but that's the normal one.)

After that, you either want to set the window's initialFirstResponder to be that view before the window is shown or you want to call -[NSWindow makeFirstResponder:] to set the first responder at a later time.

Cheers,
Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: NSView subclass does not seem to start
      • From: Alex Hall <email@hidden>
References: 
 >NSView subclass does not seem to start (From: Alex Hall <email@hidden>)

  • Prev by Date: NSView subclass does not seem to start
  • Next by Date: Re: NSView subclass does not seem to start
  • Previous by thread: NSView subclass does not seem to start
  • Next by thread: Re: NSView subclass does not seem to start
  • Index(es):
    • Date
    • Thread