On Dec 11, 2008, at 3:11 PM, Houdah - ML Pierre Bernard wrote:

Hi!

My application shows a list of files in a table view.

I have implemented drag and drop so that users may drag files from the list. I could envision them dragging the files onto other applications for viewing or dragging them on a removable media to create archive copies.

The problem occurs when the user drags the file to another folder on the same disk. By default, the Finder then wants to move the file. I need to prevent just that as it will cause havoc. For one, I would lose track of the file.

Is there a way for the originating application to control the allowed drag operations?


Check out NSDraggingSource protocol's - draggingSourceOperationMaskForLocal:. You should be able to return something like (NSDragOperationCopy | NSDragOperationLink) if you want to make sure the original file stays in the same place. If you don't mind the file being moved so long as you know its no longer available, you could instead implement -(void)draggedImage:(NSImage*)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation to be notified when a move/delete is completed.


hope this helps,
-natevw

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to