Re: Knowing when all dragged files were processed...
Re: Knowing when all dragged files were processed...
- Subject: Re: Knowing when all dragged files were processed...
- From: Phill Kelley <email@hidden>
- Date: Sat, 29 Mar 2003 11:16:24 +1100
At 18:39 -0500 28/03/2003, Jeff LaMarche wrote:
>
I've got a little "drop box" application that processes files dropped
>
on it. When all the files have been processed, I'd like to quit the
>
App, but right I only implement Application:openFile: and do not see an
>
easy way to tell if there are more files to be processed. I checked the
>
list archives, and the doc for NSApplication and NSAppleEventManager
>
but have not found a way to tell if there are still more "odoc" (I
>
think that's what they are, haven't worked with AppleEvents in years)
>
events queued up.
In this order:
1. You will receive one Application:openFile message for each file
dropped onto the application.
2. You will receive an Application:DidFinishLaunching.
In other words, once you've received the DidFinishLaunching message, you
will know that you've received all the openFile calls.
However, if your app takes a while to do its thing and your user drops more
files on the app's icon while it is running, you can still get more
openFile messages.
Probably the safest way to cater for this is to:
1. Add the filenames received from each openFile to a queue.
2. When you receive the DidFinishLaunching, spawn a thread to do the useful
work and repeatedly pass it items from the head of the queue.
3. Once the queue is empty, quit.
Regards, Phill
_______________________________________________
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.