using_20the_20eventlib_20library
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
using_20the_20eventlib_20library [2018/03/31 13:19] – external edit 127.0.0.1 | using_20the_20eventlib_20library [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 6: | Line 6: | ||
==== PROC_eventregister(WM_xxxx, | ==== PROC_eventregister(WM_xxxx, | ||
This registers a procedure to be called when the specified event occurs; the event is identified by its @msg% value. PROC_eventregister can be called multiple times with the same event identifier, in which case all the specified handlers will be called sequentially. The handler needs to be defined to receive three parameters as follows: | This registers a procedure to be called when the specified event occurs; the event is identified by its @msg% value. PROC_eventregister can be called multiple times with the same event identifier, in which case all the specified handlers will be called sequentially. The handler needs to be defined to receive three parameters as follows: | ||
+ | <code bb4w> | ||
DEF PROChandler(msg%, | DEF PROChandler(msg%, | ||
+ | </ | ||
\\ | \\ | ||
==== PROC_eventpoll ==== | ==== PROC_eventpoll ==== | ||
This simply polls the queue to see if any events are pending, and if so calls their registered handlers (if any) in the sequence in which the events occurred. If multiple handlers are registered for an event, they are all called (the last one registered is called first). Typically a program will wait in a polling loop such as:\\ | This simply polls the queue to see if any events are pending, and if so calls their registered handlers (if any) in the sequence in which the events occurred. If multiple handlers are registered for an event, they are all called (the last one registered is called first). Typically a program will wait in a polling loop such as:\\ | ||
+ | <code bb4w> | ||
REPEAT | REPEAT | ||
PROC_eventpoll | PROC_eventpoll | ||
WAIT 0 | WAIT 0 | ||
UNTIL FALSE | UNTIL FALSE | ||
+ | </ | ||
\\ If you need to be informed that the event queue overflowed, you can register a handler for that by specifying an event ID of zero: | \\ If you need to be informed that the event queue overflowed, you can register a handler for that by specifying an event ID of zero: | ||
+ | <code bb4w> | ||
PROC_eventregister(0, | PROC_eventregister(0, | ||
+ | </ | ||
\\ Despite the library' | \\ Despite the library' | ||
+ | <code bb4w> | ||
WM_MOVE = 3 | WM_MOVE = 3 | ||
WM_SIZE = 5 | WM_SIZE = 5 | ||
Line 64: | Line 71: | ||
DEF PROCoverflow(M%, | DEF PROCoverflow(M%, | ||
PRINT "Event queue overflowed!!" | PRINT "Event queue overflowed!!" | ||
- | ENDPROC | + | ENDPROC |
+ | </ |
using_20the_20eventlib_20library.1522502390.txt.gz · Last modified: 2024/01/05 00:16 (external edit)