Ken,

Thanks for trying to help me out. I tried to follow your advice, but I must not 
have completely understood it.

I changed the relevant method to this:

  func outlineView(
    _outlineView: NSOutlineView!,
    objectValueForTableColumn tableColumn: NSTableColumn!,
    byItem item: AnyObject!
    ) -> AnyObject!
  {
    let node = getDocumentNodeFrom( item )
    return node
  }


And in the particular NSTextFieldCell, I made sure “Bind to Table Cell View” 
was checked, and I set the model key path to objectValue.title. I’d love to 
attach a screenshot of what I’ve done in Xcode, but I haven’t been able to make 
a JPEG small enough to get past the mailing list’s 25K limit.

In case it matters, here’s part of the declaration of DocumentNode:

  import Foundation

  class DocumentNode : NSObject {

    var title: String
    var content: NSAttributedString
    var children: [DocumentNode]


When I run my program, the outline view still shows disclosure triangles but no 
titles for the text view cells.

--  

Charles Jenkins  

On Saturday, September 6, 2014 at 13:42, Ken Thomases wrote:
>  
> Depending on your model, you may actually find it's better to have your data 
> source return a "compound" model object and then bind the text field to just 
> a specific property of that model object. So, your data source method could 
> return the "node" and the text field could bind to objectValue.title. This 
> approach allows you to add another view (say, an image view) and bind it to a 
> different property of the object that's represented by the row. It also 
> allows the text field to be editable and directly modify the model object by 
> setting its title property (if that's something you want to allow).
>  
> Regards,
> Ken


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to