• 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: Yet another NSOutlineView question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yet another NSOutlineView question...


  • Subject: Re: Yet another NSOutlineView question...
  • From: Itrat Khan <email@hidden>
  • Date: Fri, 15 Mar 2002 17:34:57 -0500

On Friday, March 15, 2002, at 04:43 PM, email@hidden wrote:

I've set up an NSOutlineView which I've finally got working to my satisfaction - apart from one thing. How can I easily convert the index returned from the underlying TableView's selectedRow method into an index I can use to access a source array that might be deeply nested in a hierarchy that could belong to any of a number of root items, any or all of which might be expanded or not as the case may be? This sort of thing is trivial in an ordinary table view but a total nightmare when outlines are involved.


It's easiest if each item in your model maintains an inverse relationship to its container, such as a file item does for its containing directory. You could then use [NSOutlineView's itemAtRow:selectedRow] to get the selected object and therefore its container.

If your data source is a flat array, consider wrapping it in a tree class that explicitly defines the hierarchical relationships and use that tree as your data source. There may be other solutions depending on what you're trying to model.

Regards,
Itrat.

..................................................................
Itrat Khan
Modeless Software, Inc.
http://www.modeless.com
_______________________________________________
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.

  • Follow-Ups:
    • Re: Yet another NSOutlineView question...
      • From: Julian Barkway <email@hidden>
References: 
 >Yet another NSOutlineView question... (From: email@hidden)

  • Prev by Date: Re: Filtering all keyboard input in an NSTextView
  • Next by Date: Re: Dragging to text fields
  • Previous by thread: Yet another NSOutlineView question...
  • Next by thread: Re: Yet another NSOutlineView question...
  • Index(es):
    • Date
    • Thread