• 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: Drag and drop to the app's dock icon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and drop to the app's dock icon


  • Subject: Re: Drag and drop to the app's dock icon
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 12 Jun 2003 11:55:21 -0700

On Thursday, June 12, 2003, at 12:09 AM, Tim Hewett wrote:

I want my app to be able to act on files which have been
dropped onto its dock icon - I've search the developer CD
documentation but the bit that covers how to do this must
be very well-hidden if it's there at all.

When you drag a file onto an application's Dock icon, and it's accepted, then the Dock just sends the "open" Apple event to the application along with the path to the file. Your application can catch this event by setting some object to be NSApplication's delegate, and write a delegate method for "application:openFile:", which is described in NSApplication's documentation.

Now, to get the application to _accept_ the file, you need to edit the Info.plist file that PB will generate for the application. You can find this under the application's project target settings under PB. Just open the "Document Types" pane and create a new document type with the appropriate metadata identifying the document. (To accept all files, set the OS type to "****". To accept folders, set the OS type to "fold". Disks are of type "disk".)

Also, you can override the application's accepted files by holding down Command and Option while dragging the file to the Dock. This will force the Dock to send the event to the application, but I wouldn't recommend making the program dependent on this...

The same goes for
documentation on how add extra menu items to the icon's
dock menu.

You can attach a menu to the application's Dock through IB by creating a new menu instantiated outside of the menu bar, and attach it to the application's "dockMenu" outlet, which IIRC is the "File's Owner" for the main nib... Or you can provide one through the NSApplication delegate, and you can read the NSApplication documentation for more information about that.

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://dreamless.home.attbi.com/

"Great spirits have always encountered violent opposition from mediocre minds." - Albert Einstein
_______________________________________________
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.
References: 
 >Drag and drop to the app's dock icon (From: Tim Hewett <email@hidden>)

  • Prev by Date: Re: Separate list really needed?
  • Next by Date: Re: [OT] Mouse buttons (was Re: troubling article)
  • Previous by thread: Re: Drag and drop to the app's dock icon
  • Next by thread: Re: Drag and drop to the app's dock icon
  • Index(es):
    • Date
    • Thread