Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom pasteboard types?




On Aug 31, 2005, at 12:50 PM, Bryan Prusha wrote:


On Aug 31, 2005, at 12:44 PM, Jeff LaMarche wrote:


I've got a view that's both a drag source and drag destination. Dragging to and from other objects (where I've used delivered pasteboard types like PBTIFFPboardType) works fine, dragging from one of these views to another one of them, however, doesn't work.

What I've tried to do is to declare a custom Pasteboard type, which I can use to copy all attributes between two views of the same kind. Using the type seems to work - I'm able to put objects on the pasteboard using it, and when I retrieve the list of types from the pasteboard, the type shows up as available.

But no matter what I do, the object I put on the pasteboard doesn't come through. It's an NSDictionary, and it's not nil, but I get a nil object on the other end of the drag. This happens if I use setPropertyList:forType: setData:forType: (archiving the data with an NSKeyedArchiver) or setString:forType.

Can anyone think of what I might be doing wrong? Is it acceptable to declare custom pasteboard types like this?


It doesn't sound like the custom pasteboard type is the problem, but rather the data that is being added. Are all of the sub objects in the NSDictionary you're serializing CFPropertyList types or support the NSKeyedArchiver protocol? If not, then I'd wager the serialization is failing and you're simply adding an empty NSData to the pasteboard. Can you take a peek at that data before placing it on the pasteboard to verify?

Also, if you want a working example of a custom pasteboard type used for copy/paste and drag and drop, you can look at the iSpend example at developer.apple.com.


Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Custom pasteboard types? (From: Jeff LaMarche <email@hidden>)
 >Re: Custom pasteboard types? (From: Bryan Prusha <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.