Re: Delaying the Opening of Files on Launch
Re: Delaying the Opening of Files on Launch
- Subject: Re: Delaying the Opening of Files on Launch
- From: email@hidden
- Date: Wed, 14 Mar 2007 23:42:31 +0800
Hi,
I'm not sure if I fully understand the issue you encounter.
If the issue is arise because the modal loop, I wonder if - (void)
performSelector:(SEL)aSelector target:(id)target argument:(id)
anArgument order:(unsigned)order modes:(NSArray *)modes can help.
just schedule the invocation in default run loop mode, and then after
the modal loop has finished the invocation will be invoked.
HTH,
James
On Mar 14, 2007, at 6:08 AM, KJ Walker wrote:
The following issue involves an application based upon a multiple
document type which has several rare but potentially time consuming
requirements during the launch/startup period, including loading of
support data and possibly prompting the user for missing resources
(network locations, optional files, etc).
Apple documentation for NSApplication indicates the delegates
usually sees the following methods in the this order.
delegate applicationWillFinishLaunching:
delegate application:openFile:
delegate applicationDidFinishLaunching:
I find the delegate sometimes receives messages for
application:openFile: before the activities for
applicationWillFinishLaunching: are completed. This occurs when a
modal window has interrupted the activities of
applicationWillFinishLaunching:. I understand why this is
happening – the use of a modal loop related method permits the
apple event activities to continue via specialized event loop
processes.
Any thoughts on what the best way to delay opening files/documents
from the open event?
I have attempted to store the filenames and then opened them later
via a NSDocumentController’s
openDocumentWithContentsOfURL:display:error:, however this
somethings results in documents that are never shown even when the
display parameter is YES (usually when another modal window has
suspended the documents opening with a warning or request of the
user). This approach also creates a situation where the
application deletegate’s application:openFile: method returns a
result that is only a guess and not necessary the correct value
since the code has no way of knowing if the document or file sent
as part of the AppleEvent can be fully processed until the
application’s support data is fully read in.
I have also used NSWorkspace openfile: attempting to generate the
open event all over again, however sometimes I've had the wrong
application launched (when multiple but different version of the
same application can be located) and the documentation for these
NSWorkspace methods indicates the calling application is deactived
and so I figured using this avenue is not correct since it could
end up deactivating and then reactivating the application multiple
times (with multiple files on launch).
Thanks,
Kevin (KJ) Walker
Senior Mac Developer
SmartSound Software, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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