Re: what is the best (easiest) way to get the selection in an NSOutlineView?
Re: what is the best (easiest) way to get the selection in an NSOutlineView?
- Subject: Re: what is the best (easiest) way to get the selection in an NSOutlineView?
- From: Mike Bolton <email@hidden>
- Date: Thu, 7 Oct 2004 18:37:44 -0400 (EDT)
For some reason, Apple decided not to use the
outlineViewSelectionDidChange notification, and
instead assigned an action to the NSOutlineView, which
in turn calls outlineViewAction, a method they created
to handle a change of selection.
The DragNDropOutlineView example really doesn't do
anything too complicated when you think about it.
They simply obtain the number of items selected, then,
display a message to the user which differs depending
upon the number of rows selected. The only really
complicated thing they do is use an NSOutlineView
category method (selectedNodes) to return an array of
selected tree nodes.
Personally, I use the outlineViewSelectionDidChange
delegate method, since it doesn't require me to add an
IB action, but I really don't think it makes much
difference if you decide to use the action method
instead.
Mike
--- Daniel Morrow <email@hidden> wrote:
>
I have an NSOutlineView, and you can only select one
>
row in it. No
>
multiple selection of any sort.
>
>
When someone chooses a row, I want to know, get the
>
object for that
>
row, and then perform some action.
>
>
I'm installing a delegate method,
>
"outlineViewSelectionDidChange", and
>
this seems to get what I want. However, I've looked
>
at other samples,
>
Apple's "DragNDropOutlineView" and another one, and
>
neither of them use
>
this method. Actually, the DragNDropOutlineView way
>
of doing things
>
looks a bit complex.
>
>
Should I just stick with the delegate method, or try
>
something else?
>
>
-Dan.
>
>
_______________________________________________
>
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
>
______________________________________________________________________
Post your free ad now!
http://personals.yahoo.ca
_______________________________________________
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