• 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
Drag files to the Finder from NSTableView (NSHFSPromisePboardType)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drag files to the Finder from NSTableView (NSHFSPromisePboardType)


  • Subject: Drag files to the Finder from NSTableView (NSHFSPromisePboardType)
  • From: Mason Mark <email@hidden>
  • Date: Thu, 12 Dec 2002 13:08:10 -0800

Hi.

I need to be able to drag not-yet-existent files from an NSTableView to the Finder. We're building against Jaguar, so I thought I would be able to use the new HFSPromise related stuff (in AppKit release notes for Jaguar).

I see how dragging a file to the Finder works for a simple custom view, using
- [NSView dragPromisedFilesOfTypes:fromRect:source:slideBack:event:].

But from a table view, things are a little different.

Without subclassing NSTableView, the way drag and drop is handled is via -tableView:writeRows:toPasteboard: method. There does not seem to be a nice way to write HFS promises to the pasteboard from within this method.

I do notice that with Jaguar, I can write an array of promised filenames to the pasteboard, using the type NSFilesPromisePboardType. However, this doesn't seem to work with the table view's drag and drop machinery. The limited documentation for - dragPromisedFilesOfTypes: states that "the method will also write a private type necessary to allow the destination to ask for the filenames when the drag is dropped." Seems like I would need to do that from within the writeRows method to make it work.

If using -dragPromisedFilesOfTypes: is really the only current way to drop promised files onto the Finder, it seems that there would be some fancy footwork involved in using it with a table view. I am amenable to the idea of subclassing NSTableView if necessary, but I don't want to totally override -mouseDown...

So, are there any samples of this? Or even a known Cocoa application that does this, whether or not the source is available?

Since we're targeting 10.2, I could possibly use a Carbon table view widget instead of NSTableView, even though our app is Cocoa--but I naturally wouldn't be thrilled about doing that (I haven't even yet investigated the Cocoa/Carbon mix-and-match GUI stuff that is now possible).

Finally, if any Apple folks maybe expect this task to get easier with some update coming out in the next couple months, do feel free to drop me a line privately. ;-)

Thanks in advance for any pointers or hints,

--
Mason Mark
Five Speed Software, Inc.

P.S.
I do agree with the recent threads opining that the implementation (at least from the Cocoa standpoint) of HFS promise drags seems pretty kludgey. I hope the API matures to the point where HFS promise data is handled in a similar manner to other pasteboard types. In the case of this app, the drag out of the table view should also generate standard and private pasteboard data types, in addition to HFS promise.

So I am also interested if anybody has some clever hackery, like suppressing the slideback and writing out promised files from a drag to the Finder that is actually rejected by the Finder. Or whatever.
_______________________________________________
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: Novice question about Interface builder
  • Next by Date: Autohide app
  • Previous by thread: Getting Window image.
  • Next by thread: Autohide app
  • Index(es):
    • Date
    • Thread