Re: Dual Purpose Applet Question
Re: Dual Purpose Applet Question
- Subject: Re: Dual Purpose Applet Question
- From: email@hidden
- Date: Tue, 5 Dec 2000 17:49:38 -0500
On Tue, 05 Dec 2000 16:40:14 +0000, From: Mr Tea <email@hidden> asked,
>
At the risk of revealing my ignorance (generally a good idea when one wishes
>
to learn something), I started out with the following test script:
>
>
on open
>
beep 1
>
end open
>
on run
>
beep 2
>
end run
>
>
Sure enough, it beeps when I drag something onto it, but does nothing when I
>
double-click. Clearly the latter is different to running the script, as it
>
obediently beeps twice when run from the script editor. Where do I go from
>
here?
If the applet was "stay open", and you double click on it after it is running,
it doesn't get sent a "run" event.
The solution is to provide a "reopen" handler
on reopen
beep 3
end reopen
The initialization logic in complex programs can get tricky, because you may get
"reopen" after an "open", or you may get it after a "run". But in your case,
you probably can just make the "reopen" handler just call "run".
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden