Dragging from NSTableView to Finder
Dragging from NSTableView to Finder
- Subject: Dragging from NSTableView to Finder
- From: Andy Finnell <email@hidden>
- Date: Mon, 7 Jul 2003 18:29:18 -0500
Hey all,
I have a simple NSTableView and I'm trying to make it so the user can
drag files into my list view and drag files out of it into the Finder.
I have the dragging from the Finder to my app working, but I can't get
the Finder to accept my drags.
Here's what my tableView: writeRows: toPasteboard: code looks like:
- (BOOL) tableView: (NSTableView *) tableView writeRows: (NSArray *)
rows toPasteboard: (NSPasteboard *) pboard
{
std::vector<ProjectFileRef>* files = mFiles;
NSMutableArray* fileNames = [NSMutableArray arrayWithCapacity: [rows
count]];
for(int i = 0; i < [rows count]; i++) {
int rowIndex = [[rows objectAtIndex:i] intValue];
ProjectFileRef fileRef = (*files)[rowIndex];
NSString* absolutePath =
ConvertCppStringToObjCString(fileRef.GetAbsolutePath());
[fileNames addObject: absolutePath];
}
[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType]
owner:nil];
[pboard setPropertyList:fileNames forType:NSFilenamesPboardType];
return YES;
}
From the debugger I've verified that absolutePath is indeed a valid
file path, but the Finder wants nothing to do with my drag. Its not
even giving the drag feedback hilite. I can drag fine from within my
application (within the same list view or from document to document).
I'm probably doing something stupid, but I can't see it. Any pointers?
Thanks,
-andy
_______________________________________________
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.