0
votes

I've been experimenting with the drag-and-drop support in Cocoa - draggingEntered:withInfo:, draggedImage:beganAt:, etc. It looks like OS X only triggers "drag" events when you drag something out of one view and into another.

I have a very large view which I draw stuff inside, and I'm looking for a way to drag objects within it; the objects never leave the view, so the above messages don't seem to be generated, and no drag starts. Is there a way to do "drag and drop within a view", or do I have to implement it myself?

1
What kind of objects do you want to drag? On what do you want to drop them (just anywhere in your large view, or on a particular type of subview)? - rdelmar
From anywhere within the view to anywhere within the view - no subviews are present. - Colen
What do you want to drag? Are they the things you drew? As far as I know, only certain things can be dragged using the normal drag and drop protocol. - rdelmar
Yes, I'll draw arbitrary things within a view, and I want the user to be able to click on them and drag them around (possibly to another view full of also arbitrarily-drawn things). - Colen

1 Answers

0
votes

I'm pretty sure you can't do that with drag and drop. If the things you're trying to drag are objects (like NSBezier paths) you can do a hit test on them and then use mouseDown: and mouseDragged: to implement changing the origin of your object, but it's all up to you.