Re: Rootless, complex NSOutlineView?
Re: Rootless, complex NSOutlineView?
- Subject: Re: Rootless, complex NSOutlineView?
- From: publiclook <email@hidden>
- Date: Tue, 27 May 2003 13:10:04 -0400
"Cocoa Programming" by Scott Anguish, Erik M. Buck, Donald A. Yacktman
ISBN: 0672322307 describes how to use NSOutlineView. You can look at
the detailed table of contents and examples here:
http://www.cocoaprogramming.net/
I think Amazon.com has the full index.
Yes, you can have any number of root nodes. Just return the correct
number when the NSOutlineView asks your data source
-outlineView:numberOfChildrenOfItem: with a nil item. Then each time
the NSOutlineView asks your data source -outlineView:child:ofItem: with
a nil item return a root item.
You can do anything you want with NSOutlineView and the types of
children etc. make no difference as long as you provide the information
the NSOutlineView needs. If you don't want to include a particular
root item or any other item for that matter, just don't provide it to
the NSOutlineView and while your at it, don't mislead the view about
the number of items it should display.
If your problem is that you don't understand the role of a data source,
the simplest examples that you already have will aid you. If you don't
understand how to report the number of items to display when the
outline view asks you, you may have problems with your own data
structures. If after telling the outline view how many items there are
you can't provide them, you data structures are definitely broken or
ill-conceived.
On Tuesday, May 27, 2003, at 12:11 PM, David Wood wrote:
So I'm *very* slowly learning NSOutlineView through careful
experimentation, and aided by what documentation I have on the subject
(which admittedly isn't much; "Cocoa Programming for Mac OS X" doesn't
cover NSOutlineView, nor does "Building Cocoa Applications" or the
Vermont Recipes book.)
1. The examples I've seen show NSOutlineView having one root node
displayed, and several child nodes underneath it which may also have
children. Is there any way not to display that one root node? In my
application, that root node is never going to change, and it's enough
that I know it's there. Or is there a way to display an NSOutlineView
with "multiple" roots?
2. The data I'm trying to display in NSOutlineView is very complex; at
no level does a child match the type of its parent. Certain types of
information store other types of information, which serve as parents
for *other* forms of information, etc. The NSOutlineView seems closest
to what I'm trying to do, but I wonder if it's good enough.
I've seen some of the NSOutlineView sample code on the BigNerd site,
but the example I grabbed was the simplest, and not representative of
my problems now. And I'm trying to avoid creating an entirely new
custom control because I'm not that advanced yet.
Anyone care to take a crack at this problem for me? The list is
already sick of hearing about the data structures I'm trying to create
for this program, so I won't post them here.
--David http://skipjack.bluecrab.org/~dwood
"It's not apathy... I just have a very aggressive definition of what
isn't my damn problem."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.