Re: NSOutlineView, NSTreeController and itemForPersistentObject...
Re: NSOutlineView, NSTreeController and itemForPersistentObject...
- Subject: Re: NSOutlineView, NSTreeController and itemForPersistentObject...
- From: Keith Blount <email@hidden>
- Date: Sun, 8 May 2005 06:22:55 -0700 (PDT)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hmm, I'm still having no joy with this... In the hope
that someone will soon start experimenting with
NSTreeController and run into the same problems, I've
described the problem in a little more detail here:
http://www.cocoadev.com/index.pl?OutlineViewCoreDataBindings
I've also filed a bug report, as it seems to me that
NSOutlineView's delegate and datasource methods
shouldn't be rendered unusable by using
NSTreeController and bindings...
If anyone here has played with NSTreeController and
outine views and managed to get the outline view to
save its state (and use other datasource/delegate
methods that use (id)item), I would be really grateful
if you could point me in the right direction, as I'm
sure I must be missing something here. At the moment,
it looks like I'm going to have to abandon
NSTreeController...
Many thanks,
Keith
--- Keith Blount <email@hidden> wrote:
> 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
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
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