adding_20an_20event_20to_20the_20event_20queue
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
adding_20an_20event_20to_20the_20event_20queue [2018/03/31 13:19] – external edit 127.0.0.1 | adding_20an_20event_20to_20the_20event_20queue [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Adding an event to the event queue===== | =====Adding an event to the event queue===== | ||
- | //by Richard Russell, August 2014//\\ \\ Normally, **event interrupts** (e.g. ON MOUSE, ON MOVE, ON SYS and ON TIME) take place as a result of user actions such as mouse clicks, menu selections, moving/ | + | //by Richard Russell, August 2014//\\ \\ Normally, **event interrupts** (e.g. ON MOUSE, ON MOVE, ON SYS and ON TIME) take place as a result of user actions such as mouse clicks, menu selections, moving/ |
+ | |||
+ | <code bb4w> | ||
SYS @fn%(18), handler%, msg%, wparam%, lparam% | SYS @fn%(18), handler%, msg%, wparam%, lparam% | ||
@flags% OR= & | @flags% OR= & | ||
- | Here **handler%** is the address of the event handler (see below), **msg%** is the value which will ultimately be received by the handler in the **@msg%** system variable, **wparam%** is the value which will be received in **@wparam%** and **lparam%** is the value which will be received in **@lparam%**.\\ \\ The **handler%** parameter can be the address of a custom handler or can specify one of the standard ON... event handlers as follows:\\ | + | </ |
+ | |||
+ | Here **handler%** is the address of the event handler (see below), **msg%** is the value which will ultimately be received by the handler in the **@msg%** system variable, **wparam%** is the value which will be received in **@wparam%** and **lparam%** is the value which will be received in **@lparam%**.\\ \\ The **handler%** parameter can be the address of a custom handler or can specify one of the standard ON... event handlers as follows: | ||
+ | |||
+ | <code bb4w> | ||
handler%=!388 : REM ON TIME | handler%=!388 : REM ON TIME | ||
handler%=!396 : REM ON MOVE | handler%=!396 : REM ON MOVE | ||
handler%=!400 : REM ON SYS | handler%=!400 : REM ON SYS | ||
handler%=!404 : REM ON MOVE | handler%=!404 : REM ON MOVE | ||
- | (if no relevant **ON event** statement has yet been executed, or an **ON event OFF** has been executed, handler% will be set to zero).\\ \\ If you want to determine whether the event was successfully added to the queue you can test the return value:\\ | + | </ |
+ | |||
+ | (if no relevant **ON event** statement has yet been executed, or an **ON event OFF** has been executed, handler% will be set to zero).\\ \\ If you want to determine whether the event was successfully added to the queue you can test the return value: | ||
+ | |||
+ | <code bb4w> | ||
SYS @fn%(18), handler%, msg%, wparam%, lparam% TO ok% | SYS @fn%(18), handler%, msg%, wparam%, lparam% TO ok% | ||
IF ok% @flags% OR= & | IF ok% @flags% OR= & | ||
- | If **ok%** is non-zero the event was added, if it is zero the queue was already full.\\ \\ Here is a simple example of the use of this technique:\\ | + | </ |
+ | |||
+ | If **ok%** is non-zero the event was added, if it is zero the queue was already full.\\ \\ Here is a simple example of the use of this technique: | ||
+ | |||
+ | <code bb4w> | ||
ON SYS PRINT @msg%, | ON SYS PRINT @msg%, | ||
Line 21: | Line 35: | ||
WAIT 0 | WAIT 0 | ||
UNTIL FALSE | UNTIL FALSE | ||
+ | </ |
adding_20an_20event_20to_20the_20event_20queue.1522502344.txt.gz · Last modified: 2024/01/05 00:18 (external edit)