How to set NSTextFieldCell as firstResponder.
How to set NSTextFieldCell as firstResponder.
- Subject: How to set NSTextFieldCell as firstResponder.
- From: "Adam Gerson" <email@hidden>
- Date: Wed, 20 Feb 2008 00:57:18 -0500
The short question is how do I set an NSTableColumn's NSTextFieldCell
as firstResponder.
The Long Question:
When you add a row of data to an NSTableView you can not imediatly
start typing into the first editable cell. You have to double click on
the row to get an editor. In most Apple applications, like iTunes when
you create a new playlist, the new field in the table already is
selected and has the cursor in it ready to type.
An NSTextFieldCell does not inherit from NSResponder and can not
become the firstResponder of a window and there doesn't appear to be a
way to get a reference to the cell's NSTextField which can be a
firstResponder. I can get a reference to the NSTextFieldCell of the
row. From that can I get the NSTextField it is using? Or is there some
other way to mimic the iTunes playlist behavior? The documentation
says NSTextFieldCell and NSTextField work together, but dont inherit
from one another.
>From the documentation:
A text field is implemented by two classes: NSTextFieldCell, the cell
which does most of the work, and NSTextField, the control that
contains that cell. Every method in NSTextFieldCell has a cover in
NSTextField. (A cover is a method of the same name that calls the
original method.) An NSTextField can have a delegate that responds to
such delegate methods as textShouldEndEditing:.
How I get the cell:
NSTextFieldCell *t = [[serversTableView
tableColumnWithIdentifier:@"urlTableColumn"]
dataCellForRow:[serversTableView selectedRow]];
_______________________________________________
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