• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to allow files drag from a tableView to the Finder ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: New features in cocoa.mamasam.com
  • Next by Date: Re: retain before [NSImageView setImage:] ?
  • Previous by thread: Re: New features in cocoa.mamasam.com
  • Next by thread: Re: How to allow files drag from a tableView to the Finder ?
  • Index(es):
    • Date
    • Thread