Re: NSOutlineView selection questions
Re: NSOutlineView selection questions
- Subject: Re: NSOutlineView selection questions
- From: matt neuburg <email@hidden>
- Date: Fri, 15 Nov 2002 10:26:54 -0800
On 14 Nov 2002 09:57:27 -0800, Jim Hourihan <email@hidden> said:
>
* How do I detect when selection is being extended by the
>
user and when its being replaced? The delegate gets
>
outlineViewSelectionDidChange: message, but that doesn't
>
seem to be enough information? Am I missing something? I
>
can't simply replace the selection with the selection in
>
the NSOutlineView because it doesn't include hidden
>
items. So I need to know if the user intended to modify
>
the selection or replace it.
You can tell whether the selection is being extended by recording the selection state every time you get an outlineViewSelectionDidChange:. Then the next time, you compare the new selection to the old.
The problem with outlineViewSelectionDidChange: isn't so much that there isn't enough info, since you can ask the outline anything you need to, but that it comes too late for my purposes; the time I want to know what the user is doing is back at outlineView:shouldSelectItem:, so that I can prevent it. But at *that* point, there is *no* way to know whether the user is extending the selection, so I can't answer the shouldSelectItem question intelligently. In order to implement selection the way I want it, therefore, I'm forced to modify the user's selection *after* he makes it. This triggers a recursion that I have to prevent, which is not really a problem, and looks bad because the user sees his selection happen and then un-happen, which is.
m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.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.