TIMEOUT

TIMEOUT(millisec, sub|function)
Type: directive
Sets up a timeout while the main eventloop is executed. After the timeout in milliseconds, a self-defined <sub> or <function> is executed.
If the timeout should not occur again, then the executed function should return FALSE. Canceling a timeout cannot be done using a SUB.
The amount of milliseconds can be changed to another value during runtime. Example:
INCLUDE "hug.bac", INIT, GET, SET, WINDOW, PROGRESSBAR, ATTACH, TIMEOUT, DISPLAY
DECLARE pb, x, offset 
offset = 1
FUNCTION set_value 
    INCR x, offset 
    IF x >= 100 OR x <= 0 THEN offset = -1*offset 
    SET(pb, x) 
    PRINT GET(pb) 
    RETURN TRUE 
END FUNCTION
INIT 
win = WINDOW("Progressbar", 200, 30) 
pb = PROGRESSBAR("demo", 200, 30) 
ATTACH(win, pb, 0, 0) 
TIMEOUT(100, set_value) 
DISPLAY
