The Drag/Drop Pasteboard Nightmare
The Drag/Drop Pasteboard Nightmare
- Subject: The Drag/Drop Pasteboard Nightmare
- From: Gordon Apple <email@hidden>
- Date: Thu, 28 Jun 2012 15:14:28 -0500
- Thread-topic: The Drag/Drop Pasteboard Nightmare
I have an application which I am trying to update to use the new pasteboard
protocols, NSDragSession, etc. The new version requires Lion. Drag/drop
has been an absolute nightmare. The main windows have to handle a large
number of drop types, plus there is a separate library with its own coredata
database which must also be able to store and provide a large number of
types. The pasteboard handlers are monsters, which I have tried to parse out
into more manageable chunks. My first level approach it to try to identify
pasteboard objects which conform to the new protocols or have been placed
into an NSPasteboardItem. The latter is being successfully used for private
data types. (Can¹t use the read/write object protocols because these are
managed objects and require a custom unarchiver. Yes, I¹ve filed an
enhancement request about this.)
Text handling has been especially difficult. I try to drag in text from
MSWord (2008) or TextEdit, and have all kinds of issues. Apparently MS not
only posts an RTF, but an image or a PDF of the text.
³canReadObjectForClasses² determines it has an NSImage class and I end up
with a text image, not the text, which I would like to get or convert to an
NSAttributedString. Somehow, it gets recognized as an NSImage object and
attempts to use it as such.
Although the application is for Lion, obviously, I still want it to work
with pre-Lion apps. That means the application has to handle everything,
old and new, and somehow come up with the best handler for whatever is on
the pasteboard. It ain¹t easy. It might help if there were a pasteboard
guide somewhere with suggestions and examples for how to handle complex
pasteboards using both new and old techniques. If anyone has some words of
wisdom on how to better attack this, they would be greatly appreciated.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden