How to be a drag source for the files ?
How to be a drag source for the files ?
- Subject: How to be a drag source for the files ?
- From: Quentin Mathé <email@hidden>
- Date: Mon, 14 Oct 2002 02:12:59 +0200
I have tried to implemented the files drag n' drop from NSTableView to
other applications like the Finder but without success. When I drag a
row from the table view to the Finder, the drag image appears but the
drop doesn't occur, the drag image slides back. Here is the code from
the table view data source :
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows
toPasteboard:(NSPasteboard*)pboard
{
NSArray *types;
NSMutableArray *selectedFiles = [[NSMutableArray alloc] init];
NSEnumerator *e = [rows objectEnumerator];
NSNumber *number;
int i;
while (number = [e nextObject]) {
i = [number intValue];
[selectedFiles addObject:[files objectAtIndex:i]]; // "files"
is an array filled with files paths
}
types = [NSArray arrayWithObjects:NSFilenamesPboardType, @"self",
nil];
[pboard declareTypes:types owner:nil];
[pboard setPropertyList:selectedFiles
forType:NSFilenamesPboardType];
return YES;
}
Is anybody having an idea about where is the problem
--
Quentin Mathi
email@hidden
_______________________________________________
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.