• 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: Bindings and Collections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings and Collections


  • Subject: Re: Bindings and Collections
  • From: Phil Frost <email@hidden>
  • Date: Mon, 5 Dec 2005 09:19:42 -0500

On Sun, Dec 04, 2005 at 06:22:47PM +1100, Kiel Gillard wrote:
> Hi all!
>
> I am starting to come to terms with Cocoa bindings. I am not using
> Core Data at the moment, just establishing my skills with bindings
> first. I am wondering how to allow my NSArrayController or
> NSTreeController to add objects to it's collection that are of a
> different class.
>
> For example, I would like to have an NSOutlineView such as the one in
> Mail and in iTunes, where a user can group child objects in their
> desired fashion. Currently, I have a NSTreeController and a
> NSOutlineView that allows me to build a tree of unrestricted depth
> where each object is an instance of a single kind of class.
>
> I would like the tree to terminate after the second level (ie: Group
> x > {Leaf 1, Leaf 2... Leaf n}). I have a feeling that all I need to
> do is specify and implement a leafKeyPath accessor method (or maybe
> all I will need to do is set the childrenKeyPath value) to restrict
> the depth of my tree.
>
> I would also like the class of the leaf objects to be of a different
> class to that of a group object. But how do I tell my
> NSTreeController to add an object of a specific class to the
> selectedObject's leaf item array when the selectedObject is a Group
> item? Do I override newObject or do I send the controller a
> setObjectClass: message if the selection of the outline view is, or
> changes to, an object of the Group class?
>
> Any help would be much appreciated! Thank you and please forgive my
> n00bness :-)
>
> Kiel :-)
> "Every minute spent angry is sixty seconds of happiness wasted."

It's undocumented, but you might find it useful to override
-[NSTreeController newChildObject]. It works just like newObject except
is called only for nodes with depth > 1.
_______________________________________________
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

References: 
 >Bindings and Collections (From: Kiel Gillard <email@hidden>)

  • Prev by Date: custom text data and undo
  • Next by Date: Repost: More NSBrowser/NSTreeController bugs
  • Previous by thread: Bindings and Collections
  • Next by thread: X.4 formatters behaviour and nil value ?
  • Index(es):
    • Date
    • Thread