Handle OSX Dock Drag N Drop

I looked high and low for information on how to handle drag n drop to a dock in OSX. Documentation drag n drop ( http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html#//apple_ref/doc/uid/10000069 ) I found that everything is related to drag and drop from view to view mode . If anyone can point me to some code samples, that would be great.

I am writing my application using the PyObjC bride, but Cocoa examples are equally welcome :-)

+7
cocoa pyobjc
source share
5 answers

Well, it looks like I asked too soon. Here is a great tutorial that shows how to do this:

http://recurser.com/articles/2007/04/13/cocoa-drag-to-dock-to-open/

Basically, just set your controller as an NSApplication delegate and implement the openFile method.

+6
source share

Here is a similar question from a couple of weeks ago. My answer included dragging and dropping the files you are talking about; another answer covers dragging data such as images and bits of text (not image files or text files, but bare data).

+4
source share

http://lethain.com/entry/2008/aug/06/cocoa-drag-and-drop-text-into-the-dock-icon/ covers dragging text into the dock icon with pyobjc. You can easily adapt it to other files.

+3
source share
+3
source share
+2
source share

All Articles