Is it possible to pass a pointer to an object in a drag operation?
Here is the script ...
I have an "NSArray" of custom objects. For arguments, we will say that this is a list of human objects.
The list is bound to an NSTableView through an NSArrayController . NSTableView is a drag source, and there is an NSView as a drag NSView .
When performing a drag and drop, I can easily get the name of the currently selected person (s) from NSArrayController as an NSString in the drag and drop process and pass it to the recipient in NSView .
However, I would like to be able to pass a pointer to the person object so that the recipient has access to the entire object.
It seems that the problem is that the drag and drop operation creates a new instance of the person object and does not make a reference to the selected person object, despite the fact that it implements the necessary methods in the user model. As a result, I get the person object at the destination, it just is not populated with data from the object.
Ideally, I want an object pointer, because NSView will use a reference to the object so that any updates to the object itself are reflected in both NSView and NSTableView (and wherever the object is used).
Is it possible to use a link to an object in a drag operation, or do I need to pass some kind of custom link, which is an iVar of the person object, and then search after it arrives at the destination? (It seems a bit archaic to me, given how many objects are associated with Obj-c).
I understand that a target can accept a drag operation from outside the application, but specifying the operation as a local operation will take this into account, right?
I checked the Apple docs but didn't seem to find the answer.
Drag and Drop Programming Topics
Wireframe Programming Guide
Any and all help to value highly.