Re: NSTreeController - please help, can't see the forest for the tree controller
Re: NSTreeController - please help, can't see the forest for the tree controller
- Subject: Re: NSTreeController - please help, can't see the forest for the tree controller
- From: Keith Blount <email@hidden>
- Date: Tue, 21 Jun 2005 14:28:17 -0700 (PDT)
I started to find a solution to this, but still have
some problems...
Having thought about SA Dev's suggestions, I realised
my design probably wasn't the best, so I have gone for
more of an Xcode-style design now: an outline view on
the left that shows both folders and documents
(leaves) driven by an NSTreeController, and a table
view on the right driven by an NSArrayController. My
node objects can be initialised as folders by having
an isLeaf BOOL variable set to NO and their contents
NSMutableArray (which is bound to the Children key
path in NSTreeController) set to an empty array which
can be modified. They can also be initiated as
documents with their isLeaf BOOL set to YES (this is
bound to the Leaf key path) and their contents array
to contain self (the contents won't get altered for
leaves because NSTreeController's add: will not add
anything to them). Thus the behaviour is just like in
Xcode: folders selected in the outline view show their
content in the table view (nothing if there is nothing
in them) and selected documents (leaves) show
themselves in the table view.
Problems I still have:
1) NSTreeController has no -addLeaf: method which
would be really handy. How do I set it up so that I
can have a button that will add only leaf objects (it
would have to set isLeaf to YES in the model)?
2) I still have no idea of how to get the
NSOutlineView datasource methods
-outlineView:persistentObjectForItem: and
-outlineView:itemForPersistentObject: to work with
NSTreeController because there is no way I can return
an _NSControllerTreeNode object for the latter method.
If anyone has any suggestions, I would be really
grateful.
Many thanks,
Keith
--- Keith Blount wrote:
Currently my node model object - which I've been
using for test purposes - just contains an
NSMutableDictionary of properties such as title,
description, etc, which is bound to the the
outline/table view columns, and an NSMutableArray of
contents, which is bound to the NSTreeController's
children key path.
--- SA Dev <email@hidden> wrote:
>
> Also, though probably not the best solution, you
> can always bind
> the NSTreeController's contentArray to another
> controller ...
>
>
>
> On Jun 21, 2005, at 12:34 PM, Keith Blount wrote:
>
> > Hello,
> >
> > I am beginning to think that NSTreeController is
> only
> > half-finished, but in a last, desperate attempt to
> > find anyone who might know how to resolve some of
> its
> > major issues, I hope no one minds me asking my
> > questions again here. (First, let me apologise
> posting
> > a message three times yesterday - this wasn't an
> > intentional spam, just a [human] problem with my
> > e-mail.)
> >
> > 1) Is there ANY way to filter an NSTreeController?
> > Mmalc's Filtering Controller example shows how to
> do
> > it for NSArrayController by overriding
> > -arrangeObjects:, but there is no equivalent
> method in
> > NSTreeController.
> >
> > 2) Failing that, which would be the ideal solution
> to
> > my problem (I think), this is what I want to do -
> I
> > would be grateful to anybody who could tell me
> where
> > to start: I have an NSTreeController that is
> supposed
> > to show folders in an NSOutlineView, and an
> > NSArrayController that is supposed to show the
> > contents of these folders in an NSTableView, much
> like
> > in Mail. The trouble is that in a separate view, I
> > want to set up an NSTreeController that will show
> both
> > folders AND contents in a single NSOutlineView.
> What
> > is the best way to set this up? Without filtering,
> it
> > seems impossible...
> >
> > 3) I have asked this a few times, so I am pretty
> sure
> > that no one knows the answer - in fact, I'm pretty
> > sure that NSTreeController screws this up so badly
> > that it's impossible - but... Is there *any* way
> to
> > get NSOutlineView's
> > -outlineView:persistentObjectForItem: and
> > -outlineView:itemForPersistentObject: datasource
> > methods when using an NSTreeController? Yes, I
> know
> > about the -observedObject private method which can
> get
> > the item for the former method, but there seems no
> way
> > to convert this back to an
> _NSArrayControllerTreeNode
> > object, which would be required to get these
> > datasource methods working. It seems silly that
> > NSTreeController renders these fundamental methods
> > useless.
> >
> > All these problems suggest to me that I may have
> to
> > ditch bindings for my project altogether, but if
> > anyone has any suggestions, I would be
> ***really***
> > grateful.
> >
> > Many thanks in advance,
> > Keith
> >
> > P.S. Apologies for the awful pun in the title
> >
> >
> >
> >
> ____________________________________________________
> > Yahoo! Sports
> > Rekindle the Rivalries. Sign up for Fantasy
> Football
> > http://football.fantasysports.yahoo.com
> > _______________________________________________
> > Do not post admin requests to the list. They will
> be ignored.
> > Cocoa-dev mailing list
> (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
>
>
> > 40silentalcove.net
> >
> > This email sent to email@hidden
> >
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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