Arbortext Command Language > Callbacks > timer_add_callback
  
timer_add_callback
timer_add_callback (csecs, callback[, data])
This function creates an interval timer and returns an identifier for it. csecs is the time interval in centiseconds (hundredths of a second). callback is the name of the function to be called when the interval timer expires. data is an optional user data value that is passed to the callback.
The callback function must be declared as:
function callback([data])
and must return either 0 to cancel the timer or 1 to reenable it.
Due to the overhead of executing Arbortext Command Language code, time interval values of less than one-tenth of a second are not recommended.
In the example that follows, the timer_add_callback function displays the current time on the status bar (which is updated once per second for a minute).
global nticks=0
function update_clock(win)
{
if (++nticks == 60) {
window_set(win, 'message', '')
return 0; # cancel timer
}
window_set(win, 'message', substr(time_date(), 12, 8))
return 1; # reenable timer
}
timer_add_callback(100, 'update_clock', doc_window())