On May 15, 2013, at 10:40:38, Jean Suisse <jean.li...@gmail.com> 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com