• 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
Open doc event lost with registration alert at app launch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Open doc event lost with registration alert at app launch


  • Subject: Open doc event lost with registration alert at app launch
  • From: Paul Collins <email@hidden>
  • Date: Mon, 7 Jun 2004 14:34:34 -0700

I've just added a startup alert in my NSDocument-based app for evaluation/registration. There's no problem displaying it at startup, although I do end up with two Help menus as described by others recently.

As a document-based app, double-clicking a document launches the app and opens the document. But not when my startup alert happens. Apparently the open document event is discarded when I delay the completion of launching due to my registration alert. I can let launching complete normally, but then the document window opens along with my alert, which is not desired. Nor does the new document window (on activation) appear, as it did before.

The alert uses NSApplication -runModalForWindow . In order to delay the completion of launching and displaying of full menus, opening document windows, etc, I subclassed NSApplication and overrode -finishlaunching. After the alert is dismissed, [super finishlaunching] is called and the app starts up (but without that document window).

- (void)finishLaunching {
if (![[self delegate] showTheRegistrationAlert]) { // returns NO if shouldn't continue
[NSApp terminate:self];
[NSApp stop:self]; // make sure
return;
}
[super finishLaunching];
}

I tried getting the openDoc event like this:

- (BOOL) showTheRegistrationAlert {
NSEvent *startEvent = [NSApp currentEvent];
...

...but it returns nil.

Is there a way to obtain this event, or another way to postpone opening of openDoc-at-startup documents?

Thanks,

Paul Collins

P.S. I know it's not hip to subclass NSApplication generally, but the delegate method -applicationWillFinishLaunching doesn't cause launching to wait for the alert - it just finishes launching while the alert is up.

** Now in Public beta! http://www.opendoor.com/envision/ **
** Envision: a new way to experience the web **
** Gracion Software http://www.gracion.com/ **
** Tel: +1 (541) 488-3488 iChat/AV/AIM: gracionsoft **
** DigiTunnel 1.3 PPTP/VPN client for OS X **
_______________________________________________
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.


  • Prev by Date: Re: Rasterizing an NSString to a bitmap
  • Next by Date: Re: NSDictionary design bug (was: Re: Ugly bug in Foundation, beware!)
  • Previous by thread: Re: Manually update a binding's display pattern
  • Next by thread: Transparent Images on Buttons in Jaguar?
  • Index(es):
    • Date
    • Thread