NSOutlineView, NSTreeController and itemForPersistentObject...
NSOutlineView, NSTreeController and itemForPersistentObject...
- Subject: NSOutlineView, NSTreeController and itemForPersistentObject...
- From: Keith Blount <email@hidden>
- Date: Sat, 7 May 2005 10:06:36 -0700 (PDT)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
I'm running into yet more problems with
NSTreeController... It seems that this class is only
half-finished, but maybe I am wrong. The problem is
that when you use bindings with an NSOutlineView using
NSTreeController, the delegate and datasource methods
do not have direct access to the items held by
NSTreeController, which seems like madness to me...
For instance, if you hook up a datasource to an
NSOutlineView that uses bindings (eg. the one in the
OutlineEdit Core Data example) and then try to use a
datasource method such as
outlineView:persistentObjectForItem:, you will find
that the "item" object passed in is not the actual
object, but a proxy object of class
_NSArrayControllerTreeNode.
When I was experiencing a similar problem a few days
ago, Scott Stevenson on this list very helpfully
pointed out that the only way he knew around this was
to use an undocumented method, -observedObject.
Calling this on the item passed into outline view
datasource and delegate methods does indeed retrieve
the object.
However, I am now trying to get my outline view to
save its state using the datasource methods, and
whilst I can use -observedObject to get a persistent
object in outlineView:persistentObjectForItem:, there
is no way to use this information to restore things in
outlineView:itemForPersistentObject:, because
NSTreeController will expect this to return an object
of type _NSArrayControllerTreeNode - a private API
class.
It seems insane that using Core Data and bindings with
an outline view would prevent you from using any of
the useful datasource or delegate methods that call
for direct access to the item, but I cannot find
anything to solve this.
If anybody has delved into this, I would be very
grateful for some pointers.
Many thanks in advance,
Keith
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html
_______________________________________________
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