• 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: Rick Mann <email@hidden>
  • Date: Sat, 31 May 2008 13:21:21 -0700


On May 31, 2008, at 07:34:30, I. Savant wrote:

NSTableView and NSOutlineView have a method - editColumn:row:withEvent:select: ... Make sure your tree controller has fetched and rearranged its objects (and if your view is an outline view, the corresponding "item" for your new instance is fully expanded), then call the -editColumn:row:withEvent:select: method.


In this situation, I've got an existing tree controller (and associated view) in some state. The user has chosen to add a new item, so my document's -addItem: method has been called. Currently, it's implemented like this:

http://pastie.caboo.se/private/x7ln7slfzqyltdx7onj0eq

- (IBAction)
addItem: (id) inSender
{
NSManagedObject* entity = [NSEntityDescription insertNewObjectForEntityForName: @"Item"
inManagedObjectContext: [self managedObjectContext]];

NSArray* curSelection = [mItemsController selectedObjects];

if ([curSelection count] > 0)
{
Item* curItem = [curSelection objectAtIndex: 0];
Destination* curDest = [curItem valueForKey: @"destination"];
[entity setValue: curDest forKey: @"destination"];
}

[mItemsController addObject: entity];
}


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?

TIA,
--
Rick

_______________________________________________

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


  • Follow-Ups:
    • Re: Opening column for edit after adding to tree controller?
      • From: Jonathan Dann <email@hidden>
    • Re: Opening column for edit after adding to tree controller?
      • From: "I. Savant" <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>)

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