Drag and drop : setData forType issue

12 views
Skip to first unread message

Nicolas Clavier

unread,
Nov 24, 2009, 4:57:36 AM11/24/09
to Cappuccino & Objective-J
Hi all,

In my approach to drag and drop, I find myself struggling with this method of the drag source:

[aPasteboard setData:---- forType:aType];

Here is my code:

The small red square is draggable and carries it's background color to the green square.
It works when passing a HEX string with setString: ForType: (the code is commented in the gist)

But when passing a color object, I get this error:
Objective-J.js:1741 [CPColor string] unrecognized selector sent to instance 0x002653

As well, in this case, the dragged view becomes the entire window object instead of little red square.
I run this example in a CIB app created with Atlas Beta 0.9.7.

Any idea why CPData is triggering the (SEL)string: on CPColor when it's supposed to only push the object to a dictionary using aType as a key ??

Thanks for your time,
Cheers,
Nicolas

Nicolas Clavier

unread,
Nov 26, 2009, 8:56:24 AM11/26/09
to Cappuccino & Objective-J
Any one has a hint as to this problem, or some similar experience.. 
I can't find what did I do wrong.

Begin forwarded message:

--

You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
To post to this group, send email to objec...@googlegroups.com.
To unsubscribe from this group, send email to objectivej+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/objectivej?hl=en.

Ross Boucher

unread,
Nov 26, 2009, 9:51:39 AM11/26/09
to objec...@googlegroups.com
You can't pass a CPColor. You need to pass a CPData object. Pass your color through CPKeyedArchiver.

Nicolas Clavier

unread,
Nov 26, 2009, 10:45:30 AM11/26/09
to objec...@googlegroups.com
... which I'd have found out myself if I accurately read the documentation for CPPasteboard :p
Works like a charm, thanks for your lights.
nicolas.
Reply all
Reply to author
Forward
0 new messages