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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to