NSPasteboardItem issues
NSPasteboardItem issues
- Subject: NSPasteboardItem issues
- From: Gordon Apple <email@hidden>
- Date: Wed, 20 Jun 2012 12:28:31 -0500
- Thread-topic: NSPasteboardItem issues
I'm trying to convert code to use the new pasteboard methods, and having a
few issues. For private types, I need to use NSPasteboardItem because the
read/write protocols don't work for managed objects. (readObjects
automatically uses NSKeyedUnarchiver and I use a subclass to provide the
moc.) The following claims success in writing to the general pasteboard,
but the paste handler is not seeing the NSPasteboardItem. The property list
is an array of data.
// Copy
- (void) putShapes:(NSArray*)shapes ontoPasteboard:(NSPasteboard*)pboard {
[pboard clearContents];
NSPasteboardItem *pbItem = [[NSPasteboardItem alloc] init];
[pbItem setPropertyList:[self propListForShapes:shapes]
forType:RTPShapesType];
NSArray *objArray = [NSArray arrayWithObject:pbItem];
BOOL success = [pboard writeObjects:objArray];
// success = YES;
}
// Paste
classArray = [NSArray arrayWithObject:[NSPasteboardItem class]];
if([pboard canReadObjectForClasses:classArray options:dict]) {
// This fails. *dict = [NSDictionary dictionary]
Is there anything obvious I'm missing?
Another question -- Dragging in a color chip provides both an NSColor and an
NSPasteboardItem. Given the first, what use is the latter?
_______________________________________________
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