Re: Responding to the keyboard in an NSCell
Re: Responding to the keyboard in an NSCell
- Subject: Re: Responding to the keyboard in an NSCell
- From: Graham Cox <email@hidden>
- Date: Thu, 25 Nov 2010 21:46:55 +1100
On 25/11/2010, at 9:37 PM, Thomas Davie wrote:
> I'm trying to implement an NSCell which should be able to respond to the user pressing backspace to delete something, but I don't quite see how keyboard handling is meant to work. The - (BOOL)acceptsFirstResponder method seems to suggest that NSCell *should* be an NSResponder subclass. It isn't though, and it doesn't get sent things like -keyDown: if you return YES from acceptsFirstResponder.
>
> I get the feeling that I'm missing something obvious here, but I could do with a prod in the right direction.
A cell is usually a component of a view. The view is the responder, but I presume the -acceptsFirstResponder method in NSCell is really there so that the host view can defer to its cell to answer that question.
If you want to use the cell in a standard view, such as a tableview , matrix, or other control, you'll have to figure out how those classes interact with their cells. If it's in a custom view of your own, you can probably be more loose with how you do it, if compatibility with standard controls isn't required. Though in that case, you could just make a custom view.
--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