Custom view, selection consistency with NSTableView
Custom view, selection consistency with NSTableView
- Subject: Custom view, selection consistency with NSTableView
- From: Paul Szego <email@hidden>
- Date: Sun, 17 Apr 2005 14:56:19 +1200
Hi,
I've a custom view that provides a graphical representation of objects
from an NSArrayController. I also have the same data displayed in an
NSTableView. I'm trying to implement selection via the custom view, in
line with Apple's human interface guidelines.
For selection with mouse clicks most things are possible, but I cannot
figure out how to easily implement shift-clicking using the additional
model so that it co-operates with the NSTableView. To do this would
require a common understanding between the two views of what the anchor
point and active end are, but since they only communicate via the
NSArrayController I can't see how this is possible without at least
some conventions on how this should be determined.
To elaborate: if I perform a series of shift-clicks in the table view
the selection changes. For example if there are 10 rows:
- click on row zero: row zero is selected.
- shift-click on row 3: rows zero to 3 are selected.
- command-click on row 9: rows 0 to 3 and 9 are selected.
- shift-click on row 7: rows 0 to 3 and 7 to 9 are selected.
If I create a second table view identical to the first one, things also
work. For example, if the first three mouse clicks in the scenario
above are in the first table view, but the fourth one is done in the
other table view the same results are observed. This would seem to
imply that the table views are able to derive the anchor point and
active end just from the change notifications of the selectionIndexes
from the array controller.
For single clicks or command clicks this sounds simple. For shift
clicks there's slightly more to it: you have to determine if the
addition to the selectionIndexes is higher or lower than the anchor
point and act accordingly.
So before I try to nail this down from observation, is it documented
anywhere just what the "standard" behaviour is? I've read the Human
Interface Guide, but the details on selection in lists doesn't appear
to go into this much detail. Does anyone have any ideas or pointers to
further information?
Thanks, Paul.
_______________________________________________
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