• 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
Re: AppleEvents and modal dialogs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleEvents and modal dialogs


  • Subject: Re: AppleEvents and modal dialogs
  • From: Uli Kusterer <email@hidden>
  • Date: Sat, 9 May 2009 00:08:54 +0200

On 08.05.2009, at 21:16, James Walker wrote:
I have a mostly-Carbon app that runs some Cocoa modal dialogs using - [NSApplication runModalForWindow:]. If an Apple Event (such as 'odoc') arrives while such a dialog is showing, it just gets eaten. I'd like to have it either handled or deferred. I tried creating an NSApplication delegate object, but its application:openFile: method doesn't get called.

You probably need to install a kEventAppleEvent Carbon Event Handler as described in CarbonEvents.h's entry on kEventClassAppleEvent / kEventAppleEvent:


	//	If you need to handle this Carbon event yourself, the necessary
	//	steps are: (1) remove the Carbon event from the queue. The
	//	AppleEvent requires some special preparation before it can be
	//	processed, and this preparation only occurs when the event is
	//	dequeued. (2) Use ConvertEventRefToEventRecord to get an
	//	EventRecord from the Carbon event. (3) Call AEProcessAppleEvent
	//	on the EventRecord.

It appears that RunApplicationEventLoop() installs a handler for this event, but in mixed Carbon/Cocoa applications, nobody installs this on the Cocoa event loop (just like in WNE-based Applications that call RunAppModalLoop()).

I don't remember all the details, but you may have to wait until there actually *is* an event loop to install it on, i.e. do this in - applicationDidFinishLaunching:, or even after each invocation to runAppModalLoopForWindow (but before it returns).

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

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


References: 
 >AppleEvents and modal dialogs (From: James Walker <email@hidden>)

  • Prev by Date: Re: Cancel NSThread - cocoa/mysql database search...
  • Next by Date: Re: HFS Format API?
  • Previous by thread: AppleEvents and modal dialogs
  • Next by thread: Re: AppleEvents and modal dialogs
  • Index(es):
    • Date
    • Thread