• 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
Re: Drag and Drop from an app to the Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and Drop from an app to the Finder


  • Subject: Re: Drag and Drop from an app to the Finder
  • From: Mark Piccirelli <email@hidden>
  • Date: Tue, 25 Sep 2001 11:05:21 -0700

Charles --

On Sunday, September 23, 2001, at 02:13 AM, Charles Srstka wrote:

1. I have no idea what these different pasteboard types are or how I should be writing to them. Specifically I wonder about the CorePasteboard types. It seems that CorePasteboardFlavorType 0x68667320 is the one that allows the drag-and-drop to work. However, when CorePasteboardFlavorType 0x68667320 is in the list, NSFilenamesPboardType and CorePasteboardFlavorType 0x6675726c must both also be in the list. If CorePasteboardFlavorType 0x68667320 is present without the other two, the Finder will crash when I try to drag files to it. What are all these different pasteboard types, and how should I use them?

Cocoa automatically converts data your app adds to the pasteboard to types that Carbon apps will understand, and these items are the result. CorePasteboardFlavorType 0x68667320 corresponds to the traditional Mac OS 'hfs ' type (fire up gdb and type "p (char[4])0x68667320"). CorePasteboardFlavorType 0x6675726c is 'furl', which is documented at <http://developer.apple.com/technotes/tn/tn2022.html>.

Your Cocoa app should never have to add CorePasteboardFlavorType data to a pasteboard. Put an NSFilenamesPboardType item on the pasteboard, and Cocoa will convert it to the 'hfs ' and 'furl' type items that the Finder needs. 'hfs ' items are only added to the pasteboard for files that exist at the moment you add the NSFilenamesPboardType data to the pasteboard. 'furl' items are added to the pasteboard regardless of whether or not the listed files actually exist. I suspect that the Finder needs both 'hfs ' and 'furl' items for dragged files.

Your Cocoa app should always ignore the CorePasteboardFlavorType items when they're encountered on a pasteboard.

2. I also have a problem with dragging multiple files to the Finder at once. When I drag two files from my program to the Finder, both get created, but only the first on gets moved to the place I dragged it to. I have no idea why this occurs.

This was a bug in the automatic pasteboard item conversion. It's been fixed for Mac OS 10.1.

3. I have noticed that I can drag files from my program to any Classic or Carbon application, but that it never works when dragging to a Cocoa application. While not absolutely necessary, it would be nice if this functionality worked, because it would make the program very flexible.

I'm not sure what's going wrong with this in your case. You are supposed to be able to drag multiple files from Carbon apps to Cocoa apps. Dragging from the Finder to Project Builder works in 10.0.x, for instance, I'm pretty sure.

-- Mark


  • Follow-Ups:
    • Re: Drag and Drop from an app to the Finder
      • From: Charles Srstka <email@hidden>
References: 
 >Drag and Drop from an app to the Finder (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: SELs in arrays
  • Next by Date: Re: SELs in arrays
  • Previous by thread: Drag and Drop from an app to the Finder
  • Next by thread: Re: Drag and Drop from an app to the Finder
  • Index(es):
    • Date
    • Thread