Some events are not attached to a specific form, and are considered as system events - these are the timer and DDE events. These events have a sys_
prefix for their handler names, instead of the formname
_ prefix used for form events. For example, the wd'q'
result for a timer event is:
+----------+-----------+ |syshandler|sys_handler| +----------+-----------+ |sysevent |sys_timer | +----------+-----------+ |sysdefault|sys_default| +----------+-----------+
The wd'q'
result for a ddepoke event is:
+----------+-----------+ |syshandler|sys_handler| +----------+-----------+ |sysevent |sys_ddepoke| +----------+-----------+ |sysdefault|sys_default| +----------+-----------+
To respond to such events, you define an appropriate event handler just as for a form event handler.
For example, define a handler for a timer event that writes the current time to the session, then set the timer to be 1000 milliseconds. The timestamps when Windows signals the timer event are written to the current session
sys_timer=: (6!:0) (1!:2) 2: wd 'timer 1000' 1996 1 3 10 15 37.72 1996 1 3 10 15 38.76 1996 1 3 10 15 39.81 1996 1 3 10 15 40.9
To switch off the timer, create a new execution session (i.e. a jx window) and enter:
wd 'timer 0'