Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JHKL

macrumors newbie
Original poster
Nov 23, 2007
29
0
Toronto, ON
Hello everyone,

I'd like to implement drag and drop functionality for my application, but what I want is for the icon of the dragged item to appear on the screen at the position in which I let go of the mouse. For example, I want to drag a zip file and have the Finder zip icon appear on my subclassed NSView in the position where I released my mouse.

Now, I figured out how to get the Finder icon image by doing:

imageToDraw = [[NSWorkspace sharedWorkspace] iconForFile:fileLocationOnDisk];

But how do I get the co-ordinates of the mouse when the drag ended? I've tried draggedImageLocation in performDragOperation:, I've tried updating a NSPoint with the mouse co-ordinates using mouseDrag:, but not of this seems to work.

Is there anyone who can assist with this problem? I'd be very grateful.

Thanks in advance,
David Gill
 
LOL, I must need some more caffeine! :)

Turns out there was no problem at all. I forgot that for testing purposes (to see if the icon would even draw) I put a call to NSMakePoint(0,0) instead of the actual icon's point.

There actually is no problem. Everything's working now! Sorry to all! :eek:

Mods please delete this thread. Thanks.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.