SOLUTION FOUND, read edit 3
I have an nsview, and I want to be able to drag this nsview into a colorwell and make the colorwell change its color. How can I do this?
Or another question would be: how is data stored in NSColorWell for the NSColorPboardType? Because it isn't just an archived NSColor.
Hope this makes any sense
EDIT: This is a code snippet from mouseDragged in my NSView.
Then when I drag I get this message
What am I doing wrong?
Thanks.
EDIT2: ok i found out it is supposed to be NSKeyedArchiver not NSArchiver, but NSColorWell's still don't do anything when I drag to it
EDIT3: the problem was that I had this in my NSView
once i commented that out everything worked perfectly
I have an nsview, and I want to be able to drag this nsview into a colorwell and make the colorwell change its color. How can I do this?
Or another question would be: how is data stored in NSColorWell for the NSColorPboardType? Because it isn't just an archived NSColor.
Hope this makes any sense
EDIT: This is a code snippet from mouseDragged in my NSView.
Code:
pb = [NSPasteboard pasteboardWithName:NSDragPboard];
[pb declareTypes:[NSArray arrayWithObjects:NSColorPboardType, NSStringPboardType, nil] owner:self];
[pb setString:@"test" forType:NSStringPboardType];
[pb setData:[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]] forType:NSColorPboardType];
NSLog(@"%@", [NSColor colorFromPasteboard:pb]);
Then when I drag I get this message
Code:
-[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4, 0xb, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d)
What am I doing wrong?
Thanks.
EDIT2: ok i found out it is supposed to be NSKeyedArchiver not NSArchiver, but NSColorWell's still don't do anything when I drag to it
EDIT3: the problem was that I had this in my NSView
Code:
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
return NSDragOperationCopy;
}
once i commented that out everything worked perfectly