TableView Drag and Drop
TableView Drag and Drop
- Subject: TableView Drag and Drop
- From: Alex Keresztes <email@hidden>
- Date: Sun, 21 Oct 2001 15:01:04 -0500
I just signed up to this mailing list so I dont really know how things
work... But i have a problem that has been bothering me that would be
great if someone could help on.
I have been trying to get drag and drop reordering in the tableview i
have in my project, but I am having some problems. Anyone that has used
this before care to enlighten me?
The problem i was having is that the drag is started, however the
tableview never runs its validate for drop or accept drop methods. Do I
have to registerfordragged types or do some other implementation other
than the three functions in the NSTableView.h?
Here is a little snippet of what i have:
-I am not actually doing anything here, like writing to the pasteboard
or setting the new information into my data source, but merely trying to
see if the behavior is working correctly. I get the first NSLog message
when i drag a row, but i never get the other two. Anyone have any ideas?
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows
toPasteboard:(NSPasteboard*)pboard
{
NSLog (@"Dragging begun");
return YES;
}
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id
<NSDraggingInfo>)info proposedRow:(int)row
proposedDropOperation:(NSTableViewDropOperation)op
{
NSLog (@"Proposed Row: %d", row);
return NSDragOperationEvery;
}
- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info
row:(int)row dropOperation:(NSTableViewDropOperation)op
{
NSLog (@"Row: %d", row);
return YES;
}