Re: Receive drop event on dock icon
Re: Receive drop event on dock icon
- Subject: Re: Receive drop event on dock icon
- From: Ken Thomases <email@hidden>
- Date: Mon, 2 Feb 2009 04:59:14 -0600
On Feb 1, 2009, at 3:19 PM, Johannes Plunien wrote:
i've been searching without success for a hint how to receive a
event when a file was dropped on my applications dock icon. I've
already configured my apps properties to allow extensions "png jpg
jpeg gif" with store type "Binary" and "Role" viewer. So far i can
drop images to the dock icon, but i dont know how to receive that
drop event. I just need some hints where to start reading at
developer.apple.com or somewhere else.
The Dock uses Launch Services, just as the Finder does. Dropping a
document on your app's Dock icon is just like dropping it on the icon
of your app in the Finder. In both cases, Launch Services sends your
application an "open documents" ('odoc') Apple Event.
In Cocoa, the event is handled by the application:openFiles: method of
the application delegate. If you only implement application:openFile:
(singular instead of plural), then that will be invoked once for each
file.
If your application is NSDocument-based, the document controller is
sent this message, instead:
openDocumentWithContentsOfURL:display:error:.
This is documented here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_3.html#/
/apple_ref/doc/uid/20001239-1119823
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden