• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Forcing NSDragOperationCopy with drag and drop on Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Forcing NSDragOperationCopy with drag and drop on Finder


  • Subject: Forcing NSDragOperationCopy with drag and drop on Finder
  • From: Wilfried de Kerchove de Denterghem <email@hidden>
  • Date: Sun, 30 Mar 2003 20:13:31 +0200

Hello,

I'm having a problem with Drag'n'drop & the Finder.

I have a TableView in my app which contains the representation of files on the hard drive. I want the user to be able to drag them within the application (that works) but also on the Finder so that the files are copied to a new location (typically the Desktop)

I use NSFilenamesPboardType as the main flavor and a custom flavor for my in-application drag'n'drop needs. Since the files are already stored on the disk, I believe no promises are needed here.

At first, I subclassed NSTableView to return "NSDragOperationCopy" in draggingSourceOperationMaskForLocal whatever the value of isLocal is. This works well unless the user holds down command key, in which case a Move is operated by the finder. This sounded odd so I returned YES in ignoreModifierKeysWhileDragging in my table view subclass. Now only a move would be performed (no + in the cursor even when no modifier keys are held) so this isn't a good solution. It seems there is no way to force a copy-only operation for the Finder (and maybe other Carbon apps?)

I came to the point where I decided to "tolerate" a move operation if I could handle it properly (ie get notified so my app could remove the item from the TableView for example).

I used draggedImage:endedAt:operation: in my subclass to perform various tasks depending on the operation done (if its a Move, I'd update my table etc)...but...it seems that when something is dragged onto the finder, NSDragOperationGeneric is the only thing passed to this method!

My only workaround was to test if the selected files in my tableview are still at their original location (if not, I assumed a move) but this doesn't work well because sometimes it seems the method is called before the move is actually performed.

Any ideas on how to get a correct behavior?

I've searched the archive but could only find a related-problem back to 2001, and no answer was given besides "hopes" that it would be fixed.

This sounds like a quite trivial and common task to me so I can't understand why it's not working as it should.


Best Regards,

Wilfried de Kerchove de Denterghem
_______________________________________________
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.

  • Prev by Date: Re: Unarchiving Problem Solved
  • Next by Date: Re: OpenGL
  • Previous by thread: Re: Unarchiving Problem Solved
  • Next by thread: Apple default Help menu not visible in IB's MainMenu
  • Index(es):
    • Date
    • Thread