Re: Getting a splash screen to show
Re: Getting a splash screen to show
- Subject: Re: Getting a splash screen to show
- From: Steve Mills <email@hidden>
- Date: Wed, 15 May 2013 10:59:52 -0500
On May 15, 2013, at 10:40:38, Jean Suisse <email@hidden> wrote:
> In one application I have to display a splash screen while a poorly written framework (DAQmxBase from National Instruments) takes 6 to 11 seconds to initialize itself on the main thread.
> To do so, I display my splash screen as a non modal, top-level, centered window (use NSWindow's setLevel:NSFloatingWindowLevel to make it top-level).
>
> Do you require your splash screen or the registration window to be modal?
Only the registration dialog is modal. The splash is not modal because it uses no interaction. It just shows up, some messages get set (in debug builds only), and it goes away when we're all done getting set up. Here's the code that runs after the nib has been loaded. I'm not sure if everything is needed - I didn't write this code:
[splashWindow setLevel:NSFloatingWindowLevel];
[splashWindow setBackgroundColor:[NSColor clearColor]];
[splashWindow setOpaque:NO];
[splashWindow setHasShadow:NO];
[splashWindow invalidateShadow];
[splashWindow flushWindow];
[splashWindow display];
[splashWindow makeKeyAndOrderFront:nil];
SetPortWindowPort((WindowRef)[splashWindow windowRef]);
[[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO];
The strange part is that it does NOT show if Cocoa is going to restore documents. Why would that matter?
--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157
_______________________________________________
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