Re: Drag and Drop to Carbon Only
Re: Drag and Drop to Carbon Only
- Subject: Re: Drag and Drop to Carbon Only
- From: Brian Webster <email@hidden>
- Date: Sun, 31 Mar 2002 22:14:03 -0600
On Sunday, March 31, 2002, at 06:17 PM, cocoa-dev-
email@hidden wrote:
I've written drag and drop/pasteboard code before and it's
worked fine. I
have another app that uses basically the same code (it only drags an
NSStringPboardType - and no, removing the other types from this example
doesn't produce proper dragging).
I've stared at this, tested a bunch of different cases, and
likewise and
can't get it to work with other Cocoa apps. So what's going on?
The problem,
once again: I can drag and drop to any carbon app, but no cocoa
apps (other
than within this same application, that is).
One possibility might have to do with the
draggingSourceOperationMaskForLocal: method in the
NSDraggingSource protocol. The method takes a BOOL argument
that lets you return different sets of drag operations for local
and non-local drags (i.e. drags within your app and drags to
another app). You can use this to prevent a user from copying
data out of your app by drag-and-drop if you don't want them to.
However, there is a bug in the drag system whereby drags to
Carbon apps pass in YES as the flag when it should pass in NO.
I don't know what NSTableView's default implementation of this
method returns, but if it returns a different value for
non-local drags that would prevent them, that would explain why
the drags only work within your app and to Carbon apps, but not
other Cocoa apps, which do behave correctly with respect to
locality.
Try subclassing NSTableView (if you haven't done so already) and
implementing this method to return an appropriate drag operation
for both local and non-local drags.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.