Re: reloading an NSTreeController
Re: reloading an NSTreeController
- Subject: Re: reloading an NSTreeController
- From: Jonathan Dann <email@hidden>
- Date: Tue, 5 Aug 2008 19:21:15 +0100
On 4 Aug 2008, at 14:04, Gerriet M. Denkmann wrote:
On 3 Aug 2008, at 16:53, Jonathan Dann wrote:
On 3 Aug 2008, at 04:35, Gerriet M. Denkmann wrote:
On 3 Aug 2008, at 05:51, Jonathan Dann wrote:
On 1 Aug 2008, at 14:04, Gerriet M. Denkmann wrote:
But all disclosure triangels are now closed. Is there some way
to reopen them to the previous state?
I have the strong feeling that I will have to handle this
myself. Ok. So be it.
It's a common problem. Can I point you here:
http://www.cocoabuilder.com/archive/message/cocoa/2008/2/23/199705
Thank you very much for this link. You provide there a very clever
solution, but, as you aptly put in your posting: "It uses
NSTreeNode and -representedObject, so is 10.5 only."
But alas!, I need Tiger 10.4.11. (And am reluctant to use private
methods which you hint at in your posting).
Ah, sorry about that, I didn't realise. What you can do is have a
look at
http://www.wilshipley.com/blog/2006/04/pimp-my-code-part-10-whining-about.html
Wil gives a few category methods like -objectAtIndexPath: You can
(maybe) get the index path the _NSArrayControllerTreeNode and then
get your real object, in which you have an isExpanded flag.
I had a look at this. It seems that to get the real object one has
to recursively search the whole tree.
You're right, it's a shame these methods aren't available out of the
box.
In my case it seems to be much simpler just to forget about
NSTreeController and use the good old DataSource.
This is not a question about premature optimization (the trees in my
case are quite small) but just a disgust about the silly design of
the 10.4 NSTreeController.
Thanks for your help!
Kind regards,
Gerriet.
Not a problem, sometimes it is easier to use a datasource rather than
battle for ages to patch up other code. Do what works for you.
Glad to be of help.
Jonathan
http://espresso-served-here.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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