This macro retrieves and dispatches messages. If a message handler is installed, the message is forwarded to the handler to perform message processing.
The argument queued controls the processing of messages stored in the secondary queue. This queue is filled with messages which can not be processed at the time. The processing of the secondary queue should be disabled in (sub-) message loops which queue (unknown) messages by calling the macro
If the argument forever equals 0, all messages which were not processed by a handler, are returned. If forever equals 1, all not processed messages are ignored and
GETMESSAGE stays active until the application is finished (variable
APPMODE<1). Most applications uses the call
getmessage 1 1 to implement the main message loop.
The argument nodispatch can be set to 1 to disable message handlers. In this case all messages are returned and must be processed by the caller.
GETMESSAGE [ queued forever nodispatch ]
- Process messages from secondary queue (0=no, 1=yes; def.=1)
- Run while application is active, do not return not-processed (0=no, 1=yes; def.=0)
- Disable message dispatching, return all messages (0=no, 1=yes; def.=0)
The shell variable
RESULT is set to the first not processed message ("
type name id par") or "
* * * *" if application is finished
Define a message handler and then process messages until the application is closed.
setmsghandler * * mh do while $AppMode != 0 getmessage end setmsghandler * *