Re: AppleEvent handlers don't seem to work.
Re: AppleEvent handlers don't seem to work.
- Subject: Re: AppleEvent handlers don't seem to work.
- From: Matt Neuburg <email@hidden>
- Date: Thu, 15 Jun 2006 09:13:44 -0700
- Thread-topic: AppleEvent handlers don't seem to work.
On Thu, 15 Jun 2006 06:23:32 +0100, Martin Redington <email@hidden>
said:
>
>Ah. In fact, that was the answer, but I was installing too early,
>rather than two late.
>
>Moving installation to applicationWillFinishLaunching: solved the
>problem.
>
>Presumably the ones I installed in awakeFromNib got over-written by
>the default ones (which isn't very nice, but isn't terribly nasty).
Correct. Annard's answer was right but for the wrong reason. I've run into
the same issue; it took me a lot of experimentation to figure out when to
install my event handlers. You might like to file a bug against the docs (on
setEventHandler:andSelector:forEventClass:andEventID:, presumably), which
really ought to make this explicit. m.
>On 14 Jun 2006, at 18:28, Martin Redington wrote:
>
>>
>> The awakeFromNib method that I'll installing the handlers from is
>> in my NSDocumentController subclass, and is the application
>> delegate, and its gets called way before
>> applicationWillFinishLaunching:
>>
>> Even if not calling early enough explains why I don't get the
>> initial open event, I should still be seeing my handler invoked
>> when reopen or open documents is sent.
>>
>> I guess its possible that I'm not generating those events, but
>> according to the docs clicking the app's dock icon when its in the
>> background should send a reopen, and I would have thought the
>> applescript fragment I sent would get me a open documents event.
>>
>> I built a test project that just installs the handlers and contains
>> the callback. Still no joy :-(
>>
>> On 14 Jun 2006, at 17:10, Annard Brouwer wrote:
>>
>>> Make sure you install these event handlers as soon as possible.
>>> For instance in your NSApp delegate in -
>>> applicationWillFinishLaunching:. Otherwise the standard Apple
>>> handler has already handled this event (it is in the docs by the
>>> way).
>>>
>>> Annard
>>>
>>> On 14 Jun 2006, at 17:49, Martin Redington wrote:
>>>> ====
>>>>
>>>> My understanding is that my app will receive an apple event from
>>>> LSLaunchURLSpec, and that I can inspect this AppleEvent, to see
>>>> if my passthrough arg os present or not.
>>>>
>>>> =====
>>>>
>>>> So, I tried installing new kAEOpenApplication,
>>>> kAEReopenApplication, and kAEOpenDocuments handlers, in my
>>>> controller's awakeFromNib method, like so:
>>>>
>>>> NSAppleEventManager *appleEventManager = [NSAppleEventManager
>>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40ucl.ac.uk
>>
>> This email sent to email@hidden
>>
>
>
>
>
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden