Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle OSX Dock Drag N Drop

Tags:

cocoa

pyobjc

I looked high and low for information on how to handle drag n drop to the dock in OSX. The drag n drop documentation (http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html#//apple_ref/doc/uid/10000069) I found all deal with dragging from view to view. If anyone can point me to some code samples, that would be excellent.

I'm writing my app using the PyObjC bride, but Cocoa examples would be equally welcome :-)

like image 814
Yi. Avatar asked Feb 17 '09 06:02

Yi.


1 Answers

Well, looks like I asked too soon. Here is a great tutorial that shows how one does it:

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

Basically, just set your controller to be the delegate of NSApplication and implement the openFile method.

like image 191
Yi. Avatar answered Sep 28 '22 05:09

Yi.