Entry
How do I let my application drag and drop files out to the finder?
May 16th, 2002 16:39
Tom Waters,
You might be tempted to use NSPasteboard's setString:forType:,
but the filenames are always an array, even if there's only one. So
you have to use setPropertyList:forType
NSPasteboard *pb = [NSPasteboard
pasteboardWithName:NSDragPboard];
NSString *filename = @"/tmp/test.txt";
[pb declareTypes: [NSArray
arrayWithObject:NSFilenamesPboardType]
owner:self];
[pb setPropertyList:[NSArray arrayWithObject:filename]
forType:NSFilenamesPboardType];
[self dragImage:iconImage at:dragPoint offset:NSMakeSize(0,0)
event:event
pasteboard:pb source:self slideBack:YES];