Re: Custom Views and Dragging ... [ with attitude ]
Re: Custom Views and Dragging ... [ with attitude ]
- Subject: Re: Custom Views and Dragging ... [ with attitude ]
- From: m <email@hidden>
- Date: Wed, 21 Apr 2004 23:47:57 -0700
On Apr 21, 2004, at 8:33 PM, J Nozzi wrote:
What the responder was driving at was that in Cocoa, what appears to
the user as "dragging a view" is not in fact dragging a view. You're
creating the illusion of dragging a view. What you're really doing is
dragging an image and after the drop, modifying the view hierarchy
yourself.
If you really must actually drag a view from one view to another,
you'll need to roll your own solution.
Thank you. Succinct, and not parroted. ;-) So the way it should go
is something like: "user begins dragging custom view, custom view
'image' is created for use with drag operation, drag operation
receiver handles things like the 'plus' cursor and possibly moves
other custom views out of the way (a la iMovie), and accepts the drop,
the custom view is 'removed' from the sending superview then added to
the target/receiving superview."
Is that about right?
Yes.
If so, does anybody have a clean example project that does just this?
I like clean examples that don't combine other 'tricks' into one - it
just makes it easier to grasp the subject you're trying to learn when
there's nothing else mixed in. ;-)
There are examples of simple drag and drop, but not with the level of
specialization and sophistication you're looking for. Another thing to
keep in mind is that it's not simple to do all of what you want to do.
If you're familiar and experienced enough with Cocoa, you could
probably throw something together fairly easily, but it might not be a
very general solution.
There's no way around it. You are going to have to get your hands dirty
and figure out how all this stuff works, get good at it, and design
what you need yourself. It will probably a while.
What you're talking about here is constraining the position of the
image that represents the data being dragged. Again, this isn't
supported by Cocoa drag-n-drop; you'll need to roll your own
solution.
Any idea how iMovie might do this?
It's entirely probable that iMovie has its own private technique for
doing drag and drop. It started out as a Carbon app you know.
_murat
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.