• 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: Master-detail interface with NSTreeController and NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Master-detail interface with NSTreeController and NSOutlineView


  • Subject: Re: Master-detail interface with NSTreeController and NSOutlineView
  • From: Greg Hurrell <email@hidden>
  • Date: Sun, 21 May 2006 04:14:48 +0200

El 20/05/2006, a las 22:14, Greg Hurrell escribió:

Two questions about implementing a master-detail interface with NSTreeController and NSOutlineView:

(1) Multiple top-level nodes

I've set up an NSTreeController that has it's content binding set to a custom class containing an array of nodes. In my NSOutlineView the custom class appears a single "root" node at the top-level. What I actually want is for the contents of the root node to be shown at the top level, that is, to have multiple top-level nodes.

Ok, managed to figure this one out for myself: instead of binding the tree controller's "content" I actually had to bind the "contentArray" (to an NSArray of objects supplied by the model), but this wasn't so straight forward. For some reason in the inspector in Interface Builder "contentArray" was ghosted and it wouldn't let me touch it until I had set up a dummy binding in "contentArrayForMultipleSelection". After doing that I was then about to set the contentArray binding and deleting the phoney contentArrayForMultipleSelection one.


My other question still remains...

(2) Master-detail interface details not working

I've tried to set up a master-detail interface similar to the one described in the documentation (http://developer.apple.com/ documentation/Cocoa/Conceptual/CocoaBindings/Tasks/ masterdetail.html), but instead of NSArrayController/NSTableView I am using the NSTreeController/NSOutlineView pair already described above.

For example, I have an NSTextField and I try to bind it to the "selection" of the controller with model key path "displayName". This same binding works fine for arrangedObjects in one of the NSTableColumns in the NSOutlineView, but in the "detail" part of my interface I don't see any value at all (or to be more precise, I see the "no selection placeholder"... Why would I be seeing that when there is definitely a row selected in the outline view?
The docs say:
Set the Bind to aspect to your array controller object. For example, MediaAssetsController.
Set the Controller Key to selection (the currently selected object).
Set the Model Key Path to the property you wish displayed in that view. For example, title.

And that is exactly what I've done but it doesn't work. Admittedly that example is for NSTableView/NSArrayController, not NSOutlineView/NSTreeController... but there seems to be a general lack of official examples for NSTreeController, and the few unofficial samples floating around on the net are generally tied to CoreData. I haven't been able to find any master/detail examples for NSTreeController with or without CoreData.


Experimenting trying to get this to work I also tried using selectedObjects as the controller key as well as playing with some array operators but that was just random experimentation and it didn't work either. I just got an empty set of parentheses "()". What do I need to do here? Or is NSTreeController not suitable for this kind of thing?

I'm hoping that someone can give me a push in the right direction...

Cheers,
Greg


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >Master-detail interface with NSTreeController and NSOutlineView (From: Greg Hurrell <email@hidden>)

  • Prev by Date: Currency to text
  • Next by Date: Complex NSTableView cell
  • Previous by thread: Master-detail interface with NSTreeController and NSOutlineView
  • Next by thread: NSWindow, Drag and Drop, Focus Ring
  • Index(es):
    • Date
    • Thread