Re: Outline View Query
Re: Outline View Query
- Subject: Re: Outline View Query
- From: Matt Neuburg <email@hidden>
- Date: Mon, 21 Feb 2005 10:15:15 -0800
On Mon, 21 Feb 2005 15:51:25 +0530, "satyam lad" <email@hidden>
said:
>I am facing a lot of problem while building a application witn NSOutlineView
>Object. Through Interface Builder i selected the NSOutlineView Object, and
>through code i control the datasource. I have made a object of NSString and
>attached as child. But in RUN MODE i am unable to detect (back in code)
>which child i have selected in the outline view. Please give a help on the
>following, if a sample code is available it would be highly appreciated.
The problem is that your object is an NSString. Remember, when something is
selected in the outline, what you're going to get back from Cocoa is a
reference to the item itself. Therefore it is up to you, behind the scenes,
to have started with a data structure that is the basis of your datasource,
such that, given an item, you know somehow where it is in the overall
structure. For example, you might build a tree structure as the basis of
your datasource:
top
sub1
subsub1
subsub2
sub2
subsub3
Now if every item in that tree has a pointer to its parent and other
appropriate methods, then if, say, you are handed a reference to subsub2,
you can quickly figure out that it is a child of sub1 and precisely which
child it is. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden