NSTableView not responding to Drag and Drop events...
NSTableView not responding to Drag and Drop events...
- Subject: NSTableView not responding to Drag and Drop events...
- From: Allan Dushan <email@hidden>
- Date: Mon, 23 Feb 2004 11:27:00 -0800
I display a Cocoa window, with an NSTableView, in a Carbon app. When I
try to drag a file from the Finder to the NSTableView none of the
NSTableDataSource dragging methods get called. If I display this same
Cocoa window from a Cocoa app, everything works correct.
I have come up with a solution to this problem, but it has its flaws
and I believe something else is going wrong that is causing me to have
to use "Duct Tape" to fix the problem. It would seem this should just
work when using a Cocoa bundle and window in a Carbon app.
Here is my solution:
1. I create a DragReceiveHandler.
2. I install my DragReceiveHandler as follows:
InstallReceiveHandler(myDragHandler, [myNSWindow windowRef], nil);
Doing this seems to "prime the pump", and the NSTableView dragging
methods get called. The problem is myDragHandler gets called as well,
and all I do in myDragHandler is return noErr. This causes a rejected
drag in my NSTableView to not get the image snap back effect. The
NSTableView rejects the drag properly, just the visual is incorrect.
Other notes:
1. I appear to make the call to NSApplicationLoad() in my Cocoa bundle
at the correct time.
2. I include the correct type, NSFilenamesPboardType to
registerForDraggedTypes: for the NSTableView.
Why do I need to do this? And, if I do not need to do this, what am I
not doing in my Cocoa Bundle that is causing Drag and Drop not to work
properly?
Thanks, Allan
_______________________________________________
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.