How to allow files drag from a tableView to the Finder ?
How to allow files drag from a tableView to the Finder ?
- Subject: How to allow files drag from a tableView to the Finder ?
- From: Quentin Mathé <email@hidden>
- Date: Fri, 3 May 2002 20:31:20 +0200
I have a tableView with files listed. For example, I can double click a
row to open the file selected. Now I want to be able to drag the
selected file from the tableView to the Finder in order to have the file
moved from its initial location to the drop target.
I have tried to implement this method where files is an NSArray filled
with paths...
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows
toPasteboard:(NSPasteboard*)pboard
{
NSArray *types;
int row;
if ([rows count] == 1) {
types = [NSArray arrayWithObjects:NSURLPboardType, nil];
row = [[rows objectAtIndex:0] intValue];
[pboard declareTypes:types owner:nil];
[[NSURL fileURLWithPath:[files objectAtIndex:row]]
writeToPasteboard:pboard];
return YES;
}
else
{
return NO;
}
}
the drag occurs but when I drop the file, the row slides black to the
tableView...
--
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.