Putting object references into Pasteboard for Drag And Drop
Putting object references into Pasteboard for Drag And Drop
- Subject: Putting object references into Pasteboard for Drag And Drop
- From: Nelson Santos <email@hidden>
- Date: Wed, 31 May 2006 22:16:20 -0700
Hi all,
I have two table views in my app for which I have successfully
implemented drag and drop using the standard documented methods.
i.e.:
A) I have defined a custom Pboard type,
B) I have implemented the required methods such as acceptDrop and
writeRows (and the other necessary methods)
C) I am using method archiveDataWithRootObject to store my object in
the pasteboard to be unarchived at the receiving end.
It works great.
Now I realize that I don't want to archive and unarchive the data
because this creates a new copy of the object. I need to original
object (it's reference) to be received at the dropped end. I don't
know how to do this.
I tried:
1) Searching the Apple mail list server and found a possible
solution: Use the pasteboard method setPropertyList:forType: to store
my object (an array) and propertyListForType: to read at the other
end. I tried this method with a custom Pboard type and with the
built in NSStringPboardType. Both yield a "Timed out fetching
data." error at the dropped end when calling method
propertyListForType.
2) Thinking about a way to get the memory address of an object,
putting it in an NSNumber object and archiving that, then doing the
reverse at the dropped end to get the object reference back via the
memory address stored as a number. I couldn't think of a way to do
this, if it's even possible.
Any ideas?
Thanks in advance,
Nelson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden