View Full Version : Populating tree control programatically
McBgnr
Apr 21, 2009, 01:09 PM
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
Apr 21, 2009, 02:37 PM
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
Apr 21, 2009, 02:38 PM
Strange, I used google with the search pattern
NSTreeController tutorial, and it found me one.
What did you enter in google?
kainjow
Apr 21, 2009, 02:49 PM
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 (http://www.literatureandlatte.com/freestuff/index.html), 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).
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.