Skip navigation.
 
mlRe: How to receive dragging files into TableView
FROM : Daryn
DATE : Wed Jan 01 19:52:44 2003

I think you need to implement tableView:acceptDrop:row:dropOperation:.

On Tuesday, December 31, 2002, at 07:09  PM, Taisuke Sato wrote:

> Hello world,
>
> I want to receive dragging files from Finder into NSTableView
> and get their path and name. I create sub class TaFileView
> from NSTableView class and register dragged type as below.
>
> - (id)initWithCoder:(NSCoder *)coder
> {
>    if(self) {
>    [self registerForDraggedTypes:[NSArray arrayWithObjects:
>        NSColorPboardType, NSFilenamesPboardType, nil]];
>    }
>    return self;
> }
>
> And I override performDragOperation as below.
>
> - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
> {
>    NSPasteboard *pboard = [sender draggingPasteboard];
>    id *dataSrc = [self dataSource];
>
>    if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
>        NSArray *files = [pboard
> propertyListForType:NSFilenamesPboardType];
>        int numberOfFiles = [files count];
>        [dataSrc numberOfFiles:numberOfFiles];
>        [dataSrc files:files];
>        [self setNeedsDisplay:YES];
>    }
>    return YES;
> }
>
> In DataSrc class which is datasource of the TableView, I want
> to get file path and name and set them into column of TableView.
> However the drag and drop operation is never received by TableView.
> How can the TableView receive dragging files?
> Any help on this issue is greatly appreciated.
>
> Regards,
> Taisuke
>
> ---
> Taisuke Sato
> <mailto: <email_removed>>
> <http://shaft.dyndns.org/~shaft/>
> _______________________________________________
> cocoa-dev mailing list | <email_removed>
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
>
>

Daryn
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlHow to receive dragging files into TableView Taisuke Sato Jan 1, 02:09
mlRe: How to receive dragging files into TableView Daryn Jan 1, 19:52
mlRe: How to receive dragging files into TableView Taisuke Sato Jan 2, 02:12