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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to