Skip navigation.
 
mlNSTableView dragging vrs NSOutlineView dragging
FROM : Jesse Grosjean
DATE : Fri Dec 10 19:05:30 2004

The dragging support provided by NSTableView is different then that
provided by NSOutlineView, I want to know how to make them act the
same. Here is the situation:

Create a table and outline view and set one of the columns in each to
contain a slider cell. At this point both views work the same. Click on
a slider and that sliders row will be selected and dragging will change
the slider value.

The problem happens when dragging is enabled. To enable dragging add
these two methods to the respective data sources and return yes.

- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray
*)items toPasteboard:(NSPasteboard *)pboard
- (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray *)rows
toPasteboard:(NSPasteboard *)pboard

The NSOutlineView continues to work as described above. When you click
on the slider cell and drag that row is selected and the slider handle
is dragged. But if you do the same thing in the NSTableView you'll get
a different behavior. Clicking and dragging on a slider cell in the
table view will start a new row drag, the row won't be selected, and
the slider value will not change.

I would like to make it so that the table view behaves like the outline
view in this case. I have a couple of ideas for hacks, but would like
to do this the correct (and preferable same as NSOutlineView) way. Does
anyone know how and where NSOutlineView is making this customization?

Thanks,
Jesse

Related mailsAuthorDate
No related mails found.