Dragging from NSTableView
Dragging from NSTableView
- Subject: Dragging from NSTableView
- From: Tito Ciuro <email@hidden>
- Date: Wed, 1 Oct 2003 17:12:00 +0200
Hello,
I'm stuck with a fairly easy feature: dragging data out of a tableview.
I've read the requirements and I believe I understand them, but somehow
my code doesn't work. I've looked in Cocoa Mamasan and the Omni Group
dev list, but haven't found an answer.
All I want is to drag a string out of the table view, as shown in the
code below, and let other apps like TextEdit to capture it via drop.
Instead, the drag starts but when I drop it in a TextEdit document, it
slides back:
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag
{
return NSDragOperationCopy;
}
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows
toPasteboard:(NSPasteboard*)pboard
{
if (tv == _mapoRecordsTableView) {
[pboard declareTypes: [NSArray arrayWithObjects:
NSStringPboardType, nil] owner: self];
BOOL result = [pboard setString: @"This is a test" forType:
NSStringPboardType];
if (result)
NSLog(@"tableView:writeRows:toPasteboard: OK");
else
NSLog(@"tableView:writeRows:toPasteboard: FAILED");
return result;
}
return NO;
}
- (void)pasteboard:(NSPasteboard *)sender provideDataForType:(NSString
*)type
{
NSLog(@"pasteboard:provideDataForType: called...");
}
What am I doing wrong?
Thanks in advance.
-- Tito
_______________________________________________
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.