Avoiding mouse polls

Dar Scott dsc at swcp.com
Sun Dec 15 19:47:01 EST 2002


On Sunday, December 15, 2002, at 02:50 PM, Ken Norris (dialup) wrote:

> ----------
>> on cycle
>>    change
>>    send cycle to me in 333 milliseconds
>>    put the result into flashingID
>> end cycle
> ----------
> Is the above "cycle" a special handler? If not, what causes it to 
> repeat?
>
This is a plain ordinary handler.

Note that its name is "cycle".  (It can be anything.)

Then, in the body is a send:

     send "cycle" to me in 333 milliseconds

That puts "cycle" (back) in the pending message queue.  Revolution will 
execute the message in a third of a second (333 milliseconds).

So, what cycle does is 1) make any changes needed to the state of your 
application and 2) ask Revolution to run it again in a third of a second.

This line saves away a reference to the pending message so it can be 
cancelled, breaking the cycle:

    put result() into flashingID

You can use units of seconds instead of milliseconds if you want.

After execution cycle the application has this change:  The changes made 
by the change handler are done.  (That can be inline if you want.)  The 
handler is scheduled for (re)execution.  An ID for cancelling is 
remembered.

(I knew you have the digest and should have slowed down my responses.  
Sorry about that.)

Dar Scott




More information about the use-livecode mailing list