Re: Making a text cell in a table editable
Re: Making a text cell in a table editable
- Subject: Re: Making a text cell in a table editable
- From: Jens Miltner <email@hidden>
- Date: Wed, 09 Jul 2008 22:32:59 +0200
Am 9.7.08 um 22:05 schrieb Vitaly Ovchinnikov:
I have a similar question. My NSTableView is bound to
NSArrayController and I need to make cell editable immediately after
adding new row. Rows added with default values and I need to allow
user to edit them easy. I have an "Add" button that fires action like
this:
- (void) onAdd: (id) sender
{
[arrayController insert:self]; // creates new object
// here I need to select new cell and start editing
}
Haven't ever had this problem, but have you tried
- (void) onAdd: (id) sender
{
[arrayController insert:self]; // creates new object
[tableView reloadData]; // <-- make table view reload it's data
[tableView editColumn:...]; // maybe table view now knows about
the new row?
}
If I call -editColumn:row:withEvent:select immediately after -insert -
it does nothing. It seems that NSTableView will be updated a bit
later, so I find out this way:
I call [self performSelector:@selector(doBeginEditing) withObject:nil
afterDelay:0];
and in -doBeginEditing I call [grid editColumn:row:withEvent:select].
This works but I feel that the more clear way exists. Does it?
On Wed, Jul 9, 2008 at 1:54 PM, Jens Miltner <email@hidden> wrote:
Am 09.07.2008 um 08:09 schrieb Chris Idou:
How do I programmatically make a text cell in a NSTableView to
have focus
and be in edit mode?
I believe -[NSTableView editColumn:(NSInteger)columnIndex
row:(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select:
(BOOL)flag] is
the method you want to call...
HTH,
</jum>
_______________________________________________
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