send ___ to me in ___ sec

Dave Cragg dcragg at lacscentre.co.uk
Wed Apr 24 04:23:09 EDT 2002


At 12:28 am -0500 24/4/02, J. Landman Gay wrote:

>There is no need ever to "send in 0". Simply issue the command. These
>two lines are equivalent:
>
>    send "myHandler" to me in 0
>    myHandler

This is not quite true, Jacque. In the following script, commenting 
in and out the "in 0 seconds" produces different results.

on mouseUp
   send "myHandler" to me ##in 0 milliseconds
   put "HERE 1"
end mouseUp

on myHandler
   put "HERE 2"
end myHandler

Using the "in <time>" extension to the send command will cause the 
currently running handler to complete before the "called" handler is 
run. You can see an example of this in the libUrl library, which 
sends the user's callback message (from a "load url" command) in 0 
milliseconds. It does this to prevent the user's callback handler 
from becoming "intermingled" with the libUrl script. For example, the 
user's callback handler might do something (exit to top??) that would 
prevent the libUrl handler completing properly.


Cheers
Dave Cragg



More information about the use-livecode mailing list