How to drag move an object?
How to drag move an object?
- Subject: How to drag move an object?
- From: Mark Dawson <email@hidden>
- Date: Mon, 14 Mar 2005 06:50:33 -0800
I'm trying to learn dragging & dropping, and so am trying to add to the Sketch example program dragging & dropping the graphic objects. I can now drag & drop (copy) them within a document, to another document, and even delete them by dragging to the trash. However, I haven't been able to figure out how to move them. When I drag (no option key selected) them, I always get the "copy" cursor and NSDragOperationCopy is passed to
concludeDragOperation.
I do have:
- (unsigned BOOL)isLocal
{
if (isLocal)
return NSDragOperationCopy | NSDragOperationMove;
else // allow dragging into trash for deleting
return NSDragOperationCopy | NSDragOperationDelete;
}
- (id <NSDraggingInfo>)sender {
return YES;
}
- (id <NSDraggingInfo>)sender {
return YES;
}
I've implemented dragImage:at in the mouseDown method.
The code also has dragOperationForDraggingInfo implemented. This returns NSDragOperationCopy, which could be the problem. However, the docs (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSTextView.html#//apple_ref/doc/uid/20000373/dragOperationForDraggingInfo_type_) say that only NSDragOperationCopy can be returned (vs NSDragOperationMove). If I just return NSDragOperationNone from it, all I get is a snap-back from my mouse-up (concludeDragOperation isn't called).
What do I need to do get get drag moving working, with drag copy only happening with the option key down?
Thanks!
mark
_______________________________________________
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