OSDN Git Service

a691c23d917156b5a3a4336e8e6823fe3dd4de2a
[bacon/BaCon-Japanese.git] / HUG / TIMEOUT.txt
1 TIMEOUT
2
3 TIMEOUT(millisec, sub|function)
4 Type: directive
5 Sets up a timeout while the main eventloop is executed. After the timeout in milliseconds, a self-defined <sub> or <function> is executed.
6 If the timeout should not occur again, then the executed function should return FALSE. Canceling a timeout cannot be done using a SUB.
7 The amount of milliseconds can be changed to another value during runtime. Example:
8 INCLUDE "hug.bac", INIT, GET, SET, WINDOW, PROGRESSBAR, ATTACH, TIMEOUT, DISPLAY
9 DECLARE pb, x, offset 
10 offset = 1
11 FUNCTION set_value 
12     INCR x, offset 
13     IF x >= 100 OR x <= 0 THEN offset = -1*offset 
14     SET(pb, x) 
15     PRINT GET(pb) 
16     RETURN TRUE 
17 END FUNCTION
18 INIT 
19 win = WINDOW("Progressbar", 200, 30) 
20 pb = PROGRESSBAR("demo", 200, 30) 
21 ATTACH(win, pb, 0, 0) 
22 TIMEOUT(100, set_value) 
23 DISPLAY