Re: Opening column for edit after adding to tree controller?
Re: Opening column for edit after adding to tree controller?
- Subject: Re: Opening column for edit after adding to tree controller?
- From: Jonathan Dann <email@hidden>
- Date: Sat, 31 May 2008 21:35:16 +0100
The problem is, I don't know how to determine to which row that
newly-added object corresponds in the table view. Is there any way?
I suppose it's the current-selected row, since it's set up to select
on add. Is there a more elegant way to find out, though (i.e., what
if adding didn't change the selection).
How does one find the row in the table view corresponding to any
given instance?
Add this to your category on NSTreeController. It calls the -
flattendedNodes method I gave you earlier. You can then get the tree
node for the whatever you added to the tree and call NSOutlineView's -
rowForItem:
- (NSTreeNode *)treeNodeForObject:(id)object;
{
NSTreeNode *treeNode = nil;
for (NSTreeNode *node in [self flattenedNodes]) {
if ([node representedObject] == object) {
treeNode = node;
break;
}
}
return treeNode;
}
For those searching the archives, the previous code examples are in
this thread:
http://lists.apple.com/archives/cocoa-dev//2008/May/msg03138.html
Jon
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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