Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

McBgnr

macrumors regular
Original poster
Apr 13, 2009
144
0
Hello,

i want to populate three control programatically. I checked the documentation for NSTreeController... there are methods like add, addchild available with it. But these are all actions, which will be called from the UI.

But I want to make tree control programatically. It can have any number of levels and nodes.

-Root
- child
- subchild
- subchild
-sub-subchild
-child
- subchild
--
-- (etc)

Suggestions are welcome.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Do you know how to work with an NSArrayController? If not, I would suggest learning how to use that with an NSTableView first. Knowing how those work together will make understanding NSTreeController/NSOutlineView much easier.
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
Strange, I used google with the search pattern

NSTreeController tutorial, and it found me one.

What did you enter in google?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Strange, I used google with the search pattern

NSTreeController tutorial, and it found me one.

What did you enter in google?

If you're referring to this, that tutorial is outdated, incomplete and 31 pages! That's a little overkill for a single class.

I just whipped up a demo project of NSTreeController without using it at all before in about 5 minutes. I would suggest to McBgnr or anyone else wanting to learn how to use NSTreeController to first learn how to use NSArrayController, and then read up on Apple's docs on NSTreeController. If you want a better understanding learn how to use NSOutlineView with the datasource/delegate also (which IMO is easier to understand than NSTreeController since there's less "magic" going on).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.