• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Understanding NSOutlineView...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understanding NSOutlineView...


  • Subject: Re: Understanding NSOutlineView...
  • From: email@hidden (Simon Fraser)
  • Date: Wed, 17 Dec 2003 10:00:52 -0800 (PST)
  • Organization: AOL

When your outline view data source methods are called with a nil
item, that means "use the root" as we discussed before. The root
item is hidden; its children are the first-level items that
get displayed. So in your case, "Hardware" and "Software" will
be children with index 0 and 1 from the hidden root item.

Be sure to look at the sample code that's in /Developer/Examples/.
There are a couple of NSOutline view samples there.

Simon

Ron Ballesteros wrote on 17/12/03, 9:03 am:

> I've been seeing that when (id)item is nil, to pass the root of the data
> structure. Most examples that I have seen has one main point/root.
> I'm just unclear as to what to pass if there isn't just one top level
> root.
>
> The behavior I am trying to achieve is similar to System Profiler
> where "Hardware" and "Software" are on the same level and there isn't
> just one root at the top as I have seen in other examples.
>
> What do I return in -outlineView: child: ofItem when I have multiple
> top level roots?
> Is there any examples that I can look at where there isn't one single
> root?
>
> thanks.
>
>
>
> On Dec 16, 2003, at 6:45 PM, Simon Fraser wrote:
>
> >
> > Note that when cocoa passes nil as the 'item' to a method, it's
> > referring to the root object. Use the root of your data structure,
> > which you presumably has as a member variable somewhere.
> >
> > The data structure that probably maps most easily to the outliner
> > model is a tree, where each item in the tree has an NSArray*
> > of children. You just pass the items around in the "id",
> > child:ofItem: just does an array lookup, and isItemExpandable:
> > just asks if there are any items in the child array.
> >
> > The somewhat confusing part of the outliner datasource is what
> > to return from "outlineView:objectValueForTableColumn:byItem:".
> > This should be something displayable (say an NSString), rather than
> > one of your cookies.
_______________________________________________
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.

References: 
 >Understanding NSOutlineView... (From: Ron Ballesteros <email@hidden>)
 >Re: Understanding NSOutlineView... (From: email@hidden (Simon Fraser))

  • Prev by Date: Re: sending mail
  • Next by Date: Re: Developing for 10.3
  • Previous by thread: Re: Understanding NSOutlineView...
  • Next by thread: Re: Understanding NSOutlineView...
  • Index(es):
    • Date
    • Thread