Re: How to receive dragging files into TableView
Re: How to receive dragging files into TableView
- Subject: Re: How to receive dragging files into TableView
- From: Daryn <email@hidden>
- Date: Wed, 1 Jan 2003 12:52:44 -0600
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@hidden>
<http://shaft.dyndns.org/~shaft/>
_______________________________________________
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.
Daryn
_______________________________________________
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.