• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Opening column for edit after adding to tree controller?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Opening column for edit after adding to tree controller? (From: Rick Mann <email@hidden>)
 >Re: Opening column for edit after adding to tree controller? (From: "I. Savant" <email@hidden>)
 >Re: Opening column for edit after adding to tree controller? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Opening column for edit after adding to tree controller?
  • Next by Date: Re: Opening column for edit after adding to tree controller?
  • Previous by thread: Re: Opening column for edit after adding to tree controller?
  • Next by thread: Finding the largest value in an NSTreeController?
  • Index(es):
    • Date
    • Thread