Re: Select tablecell on creation through arrayController
Re: Select tablecell on creation through arrayController
- Subject: Re: Select tablecell on creation through arrayController
- From: Quincey Morris <email@hidden>
- Date: Wed, 25 Feb 2009 23:11:08 -0800
On Feb 25, 2009, at 19:12, Walker Argendeli wrote:
The code is now this, which works- kindof:
[notebookController add:sender];
[notebookTableView editColumn:0 row:[notebookTableView selectedRow]
withEvent:nil select:YES];
Only problem is, for the second line, I actually have to kick off a
timer...:
[NSTimer scheduledTimerWithTimeInterval:.01
target:self
selector:@selector(beginTextFieldCellEdit)
userInfo:nil
repeats:NO];
...that calls the second line from the first snippet in
beginTextFieldCellEdit.
Anybody know what's going on here?
I assume notebookController is a kind of NSArrayController. The class
reference has this to say about the 'add:' method:
"Beginning with Mac OS X v10.4 the result of this method is deferred
until the next iteration of the runloop so that the error presentation
mechanism can provide feedback as a sheet."
So you can't do the second line right away. A NSTimer is one solution,
but a more direct approach would be to replace the second line with:
[self performSelector: @selector(beginTextFieldCellEdit) withObject:
nil afterDelay: 0];
_______________________________________________
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