How to receive dragging files into TableView
How to receive dragging files into TableView
- Subject: How to receive dragging files into TableView
- From: Taisuke Sato <email@hidden>
- Date: Wed, 1 Jan 2003 10:09:05 +0900
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.