• 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: Core Data and NSTreeController Editing Problem.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data and NSTreeController Editing Problem.


  • Subject: Re: Core Data and NSTreeController Editing Problem.
  • From: Matthew Holiday <email@hidden>
  • Date: Tue, 6 Sep 2005 11:44:50 -0500

I have a modified version of the OutlineEdit example that includes drag-n-drop (and so has been named DragAndDropOutlineEdit) to which I've made a small change which does exactly what you're looking for (see -[MyDocument createNoteWithParent:]). You can find the code at: http://homepage.mac.com/matthol2/cocoa/page2/page2.html.

Working with Core Data, outline views, and tree controllers seems to involve a few tricks to translate between indexes in the tree controller and outline items (which can then be translated into table rows). I avoid using reloadData or the tree controller add/insert methods -- I add things into the managed object context, then find them in the tree controller, and ask the outline to select them. The magic happens in an extension to NSTreeController (- outlineItemForObject:).



On Sep 6, 2005, Kevin Spraggs wrote:

I have been looking at the very impressive Core Data and Cocoa BIndings
technologies, namely the Apple example for the OutlineView using
NSTreeController (/Developer/Examples/CoreData/OutlineEdit). What has me
completely flummoxed is trying to trigger editing of any new item added
immediately, just as you can do with manually constructed OutlineViews by
using the editColumn:row:withEvent:select: method. That is, having any
default text selected and editing mode entered so that the user can replace
the default value by what ever they type in, similar behavior to that when
adding a new folder on the Desktop . I have not been able to achieve this
to date in the Apple example, even after extensive trawling of the internet
and experimentation. It seems that the obvious choice would be making use
of the editColumn:row:withEvent:select: method after calling the add:
method, but it seems that NSTreeController's add: method performs something
to stop the editing before the user has had a chance to type anything. (I
assume that it triggers a reloadData of the outlineView.) Another problem
seems to be if I manually trigger the reloadData myself followed by the
selectedRow method, this is not the new row, but the pevious, even though
the outlineView does change the selected row to the new one.


So my question is: Is it possible to do this, and if so, does anyone have
some simple example code to guide me in how to do this in the context of
the original Apple example? (An idiot's guide would be nice ;-)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: NSArrayController and table view : how to bind selection ?
  • Next by Date: Sleepycat DB
  • Previous by thread: Core Data and NSTreeController Editing Problem.
  • Next by thread: Re: Core Data and NSTreeController Editing Problem.
  • Index(es):
    • Date
    • Thread