Programmer Guide/Macro Library/GETMESSAGE: Difference between revisions
(→Notes:) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
This macro retrieves and dispatches messages. If a message handler is installed, the message is forwarded to the handler to perform message processing. | 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 <var>queued</var> 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 <code>[[Programmer Guide/Macro Library/MSGQUEUE|MSGQUEUE]]</code>. | |||
If the argument <var>forever</var> equals 0, all messages which were not processed by a handler, are returned. If <var>forever</var> equals 1, all not processed messages are ignored and <code>GETMESSAGE</code> stays active until the application is finished (variable <code>APPMODE</code><1). Most applications uses the call <code>getmessage 1 1</code> to implement the main message loop. | |||
The argument | The argument <var>nodispatch</var> can be set to 1 to disable message handlers. In this case all messages are returned and must be processed by the caller. | ||
=====Usage:===== | =====Usage:===== |
Latest revision as of 12:36, 14 June 2019
GETMESSAGE
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 MSGQUEUE
.
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.
Usage:
GETMESSAGE [ queued forever nodispatch ]
Parameters:
- queued
- Process messages from secondary queue (0=no, 1=yes; def.=1)
- forever
- Run while application is active, do not return not-processed (0=no, 1=yes; def.=0)
- nodispatch
- Disable message dispatching, return all messages (0=no, 1=yes; def.=0)
Result:
The shell variable RESULT
is set to the first not processed message ("type name id par
") or "* * * *
" if application is finished
Examples:
Define a message handler and then process messages until the application is closed.
setmsghandler * * mh do while $AppMode != 0 getmessage end setmsghandler * *
Notes:
PostMessage