• 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
NSTable - intercept item name before user editing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTable - intercept item name before user editing


  • Subject: NSTable - intercept item name before user editing
  • From: Ari Benzane <email@hidden>
  • Date: Wed, 6 Jun 2007 23:12:43 +0100

Hi Guys. Can anyone suggest a a non-hackish way to deal with the following?

My app has a hierarchical outline view of nodes to arbitrary depth, organized by 'group' and 'node' classes. You can edit the names of these items directly in the outline view. I just added a requested- feature to append to a suffix to group names '[n]' where n is the number of the group children (eg. MyGroup[1]). Here's the code from my delegate (edited for length)

- (id)outlineView:(NSOutlineView*)pOutlineView objectValueForTableColumn:(NSTableColumn*)pTableColumn byItem:(id)pItem
{
if ([pItem isGroup] && [[pTableColumn identifier] isEqualTo: @"name"]) {
return [NSString stringWithFormat: @"%@ [%d]",[pItem name], [pItem childrenCount]];
} else {
return [pItem valueForKey: [pTableColumn identifier]];
}
}


The problem is, when the user goes to edit the group name, the suffix is retained so you end up with 'MyGroup[1][1][1]' etc unless you manually remove it. The prefix needs to be removed before the user can edit the item. Is there someway I can 'intercept' the string returned when the user edits the cell, so that's it replaced with the _actual_ item name, and not the aesthetic prefixed one?

- (void)outlineView:(NSOutlineView*)pOutlineView setObjectValue:(id) pObject forTableColumn:(NSTableColumn*)pTableColumn byItem:(id)pItem
{
[pItem setValue: pObject forKey: [pTableColumn identifier]];
}


Any help appreciated.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSTable - intercept item name before user editing
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Open new document in first (empty) window
  • Next by Date: Re: Open new document in first (empty) window
  • Previous by thread: Getting Mouse Up in NSTextFieldCell (was NSTextFieldCell and stopTracking)
  • Next by thread: Re: NSTable - intercept item name before user editing
  • Index(es):
    • Date
    • Thread