• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Putting object references into Pasteboard for Drag And Drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Putting object references into Pasteboard for Drag And Drop


  • Subject: Re: Putting object references into Pasteboard for Drag And Drop
  • From: "Michael Ash" <email@hidden>
  • Date: Thu, 1 Jun 2006 15:09:27 -0400

On 6/1/06, Nelson Santos <email@hidden> wrote:
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.
[snip]

This is very easy to do, although not at all obvious.

In your -performDragOperation:, you get an NSDraggingInfo. You can ask
that for its source by doing [sender source]. The source is the object
that initiated the drag, either your view or its controller, depending
on how you set things up. So all you have to do is have a custom
method which returns the drag object, and then ask the source for it
in your destination. You bypass the question of pasteboards
altogether, skip the ugly bits where you stuff pointers into places
they shouldn't go, and get the object directly. You may have to
subclass NSTableView to add the right method but it should all be
straightforward.

Mike
_______________________________________________
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


  • Follow-Ups:
    • Re: Putting object references into Pasteboard for Drag And Drop
      • From: Nelson Santos <email@hidden>
  • Prev by Date: core data - problem with NSPopupButtonCell
  • Next by Date: ANN: CamelBones 1.0.0rc1
  • Previous by thread: core data - problem with NSPopupButtonCell
  • Next by thread: Re: Putting object references into Pasteboard for Drag And Drop
  • Index(es):
    • Date
    • Thread