• 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: Dragging, aliases, and the Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dragging, aliases, and the Finder


  • Subject: Re: Dragging, aliases, and the Finder
  • From: Andreas Schwarz <email@hidden>
  • Date: Sun, 14 Apr 2002 19:17:31 -0700

I'm not too experienced with drag-and-drop (and what I've done I implemented many months ago so my memory of specifics is fuzzy) but since this didn't get any answer I'll give it a try... If any of this is wrong, someone feel free to correct me!

Command-option dragging within the Finder displays the little "I want to
make an alias" curved-arrow cursor when held over a suitable target.
I'd like to add this functionality to my app. Am I responsible for
displaying this cursor? Does the Drag Manager handle this? Is this a
Finder-only convention? I know the Drag Manager already displays the
plus-sign cursor for copying when appropriate, so it seems reasonable
that there's some way to indicate an alias-ready drag destination as
well. But how?

What are you returning in draggingSourceOperationMaskForLocal:? I return NSDragOperationEvery and the Finder does it's thing just fine.

From what I gather, it is the dragging destination's job to respond with what kind of operation it will perform, based on the dragging source's operation mask and the modifier keys the user uses. The cursor is updated based on the dragging destination's response (ie. the Finder will note that the user is holding down the option key and will return NSDragOperationCopy, and the cursor will automatically update with the + cursor; if the user holds command-option the Finder should return NSDragOperationLink and the cursor will update to show the curved arrow).


Alternatively, if this is a Finder-only convention, can a drag
destination indicate that it will accept an alias and cause the Finder
to create an alias somehow in the drop location? Or is the drag
destination expected to respond to the drop by telling the Finder (via
AppleEvents) to create an alias in the drop location?

The dragging destination is responsible for everything. You can't drag from, say, MyFileView1 to MyFileView2 and expect the Finder to somehow know there's something going on between the two (not to mention MyFileView2 might have it's own ideas about what it wants to do with the dropped stuff).

The dragging destination would have to check for the proper modifier keys and return NSDragOperationLink (or whatever) in the draggingEntered: and draggingUpdated: methods. Then in performDragOperation: it needs to do what it wants with the information in the drag pasteboard (ie. tell the Finder to copy files or make aliases, or whatever).


2. What the proper protocol to end up with a new alias file in the drop
location?

If you're dropping onto the Finder, nothing; it'll do it itself. If you're dropping onto another view or something, the other view has to handle it. If you're writing that other view too, and want to know how to make aliases, I asked a similar question just recently on Macosx-dev (or perhaps it was this list, I can't remember anymore). Check the archives.

Good luck,
Andreas Schwarz
http://homepage.mac.com/schwarz
_______________________________________________
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: Address Book FrameWork
  • Next by Date: Using Terminal to set folder icons
  • Previous by thread: Dragging, aliases, and the Finder
  • Next by thread: Creating beautiful thumbnails
  • Index(es):
    • Date
    • Thread