#MESSAGES metastatement

Purpose | Specify which messages should be sent to a Control Callback Function.
Syntax | #MESSAGES COMMAND #MESSAGES NOTIFY

Remarks

#MESSAGES COMMAND specifies that only %WM_COMMAND messages be sent to Control Callback Functions, just as in earlier versions of PowerBASIC

#MESSAGES NOTIFY specifies that %WM_NOTIFY messages (as well as %WM_COMMAND messages) be sent to Control Callback Functions. This is the default condition, and need not be explicitly stated.

There are two general types of CallBack Functions. The first is the DIALOG CALLBACK, which is specified with the CALL DLGPROC clause of the DIALOG SHOW statement. It receives all messages which are directed to the dialog, including certain messages regarding its child controls. Specifically, this would include both %WM_COMMAND and %WM_NOTIFY messages. The second is the CONTROL CALLBACK, which is specified with the CALL CTLPROC clause of the CONTROL ADD statement. If specified, it receives all %WM_COMMAND and %WM_NOTIFY messages sent to the parent dialog.

Prior to version 9.0 of PowerBASIC for Windows, Control Callback Functions received only %WM_COMMAND messages. Beginning with PB 9.0, %WM_NOTIFY messages are sent as well. There are many situations where these added messages will prove to be very important to you. If your existing callback functions are written with complete error checking (ensuring that CB.MSG = %WM_COMMAND), this minor addition will cause no problems. It just presents additional information which can be acted upon, or just ignored. However, if callbacks were written without complete error checking, some ambiguity is possible. In this case, you should either update your Control Callback code, or suppress %WM_NOTIFY messages with a #MESSAGES Command metastatement.

See also | Callbacks, DIALOG SHOW MODAL, DIALOG SHOW MODELESS, FUNCTION/END FUNCTION