Weird Idle behavior

Richard Gaskin ambassador at fourthworld.com
Mon Mar 27 13:57:01 EST 2006


 From the Transcript Dictionary entry for the idle message:

-----------------------------------------------------------

Note:  Usually, it is easier and more efficient to use the send in time 
form of the send command than to use an idle handler, especially if a 
task needs to be executed at regular intervals. This example shows an 
idle handler that updates a clock timer:

   on idle -- avoid if possible
     global startTime
     if the seconds > startTime + 60 -- 60 seconds have gone by
       put the time into field "Clock Face"
       put the seconds into startTime
     end if
     pass idle
   end idle

The following example does the same thing more efficiently, since it 
only needs to handle a single message every sixty seconds:

   on updateClock -- a better way
     put the time into field "Clock Face"
     send "updateClock" to me in 60 seconds
   end updateClock



--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list