Hi, everyone. I have a real noob question.

My end goal is to write my own word processor similar Jer’s Novel Writer, which 
hasn’t been updated in years and is now a bit unstable. My immediate goal is to 
learn how to use the object Xcode 6’s design palette calls a Source View. It 
ultimately derives from a table view, an object which frustrates me endlessly 
even though it seems conceptually easy to understand.

I made my app’s Document class conform to NSOutlineViewDataSource and added 
@IBOutlet theOutlineView: NSOutlineView!, to which I connected the outline view 
contained in the document XIB. I can step through and see that all the protocol 
methods are being called as expected, and they are all returning what I believe 
are correct values.

In fact, except for that fact that I don’t know how to make the top-level 
objects be treated like headers, when I run the app my tree appears in the 
outline view with the proper shape: the right number of items show up at each 
level, and I can use disclosure triangles to explore the whole tree.

The problem I can’t get around is this: there’s something I don’t know that 
“everybody knows” so well, it’s never explained. I’m returning the correct 
string that should appear at every node of the tree, but it’s not being used. 
Each node in the tree is a text view cell. If I leave IB’s default title of 
“Text View Cell,” that’s what appears on every node of the tree. If I delete 
that title, then the tree items are completely blank.

I have downloaded Apple’s sample code and run and inspected the project, but 
there’s no comment to spell out the magic setting, and I’m not finding it on my 
own.

What I need to know is this: If we assume that the function shown here—

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


—returns a proper String value which came from the right element in the tree, 
how can I get my outline view’s text view cell to display it?

(BTW: I am ignoring tableColumn because the table only has one column.)

Thanks!  

--  

Charles Jenkins
_______________________________________________

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