More Droplets and AppleEvents

Ken Ray kray at
Tue Feb 27 13:09:40 EST 2007

On Tue, 27 Feb 2007 17:36:17 +0000, Dave wrote:

> Hi,
> I can't find any information on how this is supposed to work. The 
> built-in documentation says that the appleEvent message is sent to 
> the current card, however I have the appleEvent message handler in my 
> Stack Script and it gets called. So where exactly is the message sent 
> to?

It's sent to the card, but if it's not trapped there, it propgates 
along the message passing hierarchy, so you can trap it in the stack 
script if you like.
>  The Splash Screen Stack used to just be hidden, I now close it so 
> that there would be no chance that appleEvents get sent it it, 
> however, I still sometimes get the appleEvent handler in the Splash 
> stack is getting called, even though it is closed and gone!!!! How 
> can this be? 

It's because the appleEvent is sent as soon as your app starts up, and 
is sent to the first card of the first stack opened. If this is the 
Splash, then it is the stack that will receive the message, and it's 
hitting the card just before you're executing your close stack command 
to close the Splash.

> IMO, the way 
> in which appleEvents are handled needs to be improved. It's senseless 
> to have the appleEvent sent to the current card or even the current 
> stack, they should always be sent to one place. 

Well, this would be the reason to set up a backscript or library to 
catch any appleEvent messages that are sent *after* your app is already 
open. This way, you don't have to patch individual stacks, you can trap 
the event in the Splash for when the app is first launched, and then in 
a backscript for events that come in after that point.


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at
Web Site:

More information about the Use-livecode mailing list