Re: Stay Open
Re: Stay Open
- Subject: Re: Stay Open
- From: email@hidden
- Date: Thu, 11 Jan 2001 16:52:17 -0500
On Thu, 11 Jan 2001 05:33:12 -0500, Xandra Lee <email@hidden> asked,
>
Some really dumb idle questions:
>
1. Do scripts with idle routines always begin with a run statement
>
ie:
>
on Run
>
idle
>
end Run
No, but it doesn't hurt. You might have a situation where on startup you want
to do some initialization, invoke the idle handler, and finish up the
initialization.
on run
-- Initialize here
idle
display dialog "Status of something:" & blahblah
end run
>
2. Can you pass parameters to idle handlers
>
ie:
>
set x to 15
>
>
on idle(x)
>
set y to (x + 20)
>
return y
>
end idle
No. The applet shell calls the idle handler without any arguments, so if you
wrote an idle handler that needed an argument, it would give a "Missing
parameter" error.
>
3. Can an idle handle return any variable besides the time it should idle?
No. The applet shell is expecting the sleep time, and would puke if it got
something else.
It sounds like you have some function that you want to call in the run handler
and also in the idle handler. Try structuring it like this:
property a : 42
property b : 0
on run
-- Initialize here
set a to foo(x,y)
end run
on idle
set b to foo(x,y)
end idle
--
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