Skip navigation.
 
mlRe: AppleEvent handlers don't seem to work.
FROM : Matt Neuburg
DATE : Thu Jun 15 18:13:44 2006

On Thu, 15 Jun 2006 06:23:32 +0100, Martin Redington <m.<email_removed>>
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_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/m.redington%
>> 40ucl.ac.uk
>>
>> This email sent to m.<email_removed>
>>

>
>
>
>


--
matt neuburg, phd = <email_removed>, <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>

Related mailsAuthorDate
mlAppleEvent handlers don't seem to work. Martin Redington Jun 14, 17:49
mlRe: AppleEvent handlers don't seem to work. Annard Brouwer Jun 14, 18:10
mlRe: AppleEvent handlers don't seem to work. Martin Redington Jun 14, 19:28
mlRe: AppleEvent handlers don't seem to work. Martin Redington Jun 15, 07:23
mlRe: AppleEvent handlers don't seem to work. Matt Neuburg Jun 15, 18:13