>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User

# System Events

Some events are not attached to a form and are called system events.
In Windows if sdasync has been done on a socket, then the sentence
socket_handler''
is run whenever the socket state has changed.
In Windows if message WM_APP (msgid of 32768) is sent to the J window (result of wd'qhwndx') then the sentence
wdmsg_handler msgid wparam lparam
is run.
Timer and DDE events are similar to form events, but 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, run
wd 'timer 0'

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User