Re: How drag files from an NSTableView?
Re: How drag files from an NSTableView?
- Subject: Re: How drag files from an NSTableView?
- From: "M. Uli Kusterer" <email@hidden>
- Date: Thu, 8 May 2003 12:08:58 +0200
Don't forget you have to subclass NSTableView and override the
draggingSourceOperationMaskForLocal: method otherwise drags
can only be local to the table view. This is what works for me:
@implementation MyTableView
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal {
if (isLocal) return NSDragOperationNone;
else return NSDragOperationCopy;
}
@end
Thanks, I didn't know about that.
You also have to add the subclass to the GUI definition in Interface
Builder, otherwise the table view will still get created as NSTableView.
I created a subclass from the NSView template (changing the
superclass to NSTableView and removing the empty drawFrame method),
dragged it into my NIB and set the NSTableView to be of my custom
class. Still no cookie. I can drag off just like before, but Finder
is blissfully ignorant of my files :-(
[pboard declareTypes:[NSArray arrayWithObjects: nil] owner:self];
[pboard declareTypes:[NSArray arrayWithObjects:
NSFilenamesPboardType, nil] owner:self];
[pboard setPropertyList:[NSArray arrayWithObjects: nil]
forType:NSFilenamesPboardType];
[pboard setPropertyList:[NSArray arrayWithObjects:
@"/Users/timhewett/testfile", nil] forType:NSFilenamesPboardType];
Why is this nil stuff needed? Do the arrays have to be
nil-terminated for NSPasteboard? Why are you declaring an empty types
list first? Can anybody point me at some docs for this stuff? I can't
seem to find *anything* on Apple's web site. :-(
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.