On Mar 21, 2008, at 10:47 AM, Sherm Pendley wrote:

Well, the glib answer is that it returns whatever the dragging source passed as the first argument to - dragImage:at:offset:event:pasteboard:source:slideBack:.

Seriously though, I can't explain what you're seeing, but I can duplicate it. In my tests, I couldn't get anything other than NULL from -draggedImage for dragged files from either Finder or Xcode. I even tried pasting a custom icon onto a file, which made no difference. What I suspect is that both apps are passing NULL to the above method, and so that's what gets passed along to your app.

I finally got back into some drag and drop portions of my code, this time also programming my own drag source. In that case (when the drag source is the app itself) calling -[<NSDraggingInfo> draggedImage] produces a pointer to the image, as you describe above.

The interesting thing is that this image pointer is the same pointer as passed in. Since this is in the source application's address space, the dragging internals would have to make a copy in memory accessible from the dragging destination application's space for things to work. So I wonder if it doesn't just return nil in that case.

The window server does display this image when other apps are active though, and even in other Spaces. (But of course there's the obligatory Spaces SNAFU: if the drag is rejected the image zips to its original location but in the CURRENT space, instead of zipping off toward the space where it came from. Bug filed.) And of course, the big gaping hole in that theory is that the pasteboard data itself can be transferred between apps. This is done through the pasteboard daemon, so the dragging sender object would have to put the image into the NSPasteboard it has. Perhaps possible, but not likely.

Oh, and I apologize for the snarky tone of my first response. Thanks for being a good sport about it. :-)

No problem, I was pretty curt in my first post. I'd seen the same question go unanswered a few times before, so I guess I didn't want to waste time beating around the bush again. I was glad to just get a reply at first!

Maybe I've done enough handwaving above that someone can confirm or deny my allegations. I hypothesize that the image could be transferred between applications but the App Kit implementors never found it worth doing so. Thus it's the documentation that needs to be fixed to warn that -draggedImage: will likely return nil; the framework is behaving correctly.[/hypothesis]

thanks,
-natevw

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to