To use the methods defined by the mixin class MessageExtensions you must inherit from this class by specifying the INHERIT option for the ::CLASS directive in the class declaration. For example:
::class MyExtendedDialog SUBCLASS UserDialog INHERIT MessageExtensions
The MessageExtensions class requires the class definition file oodwin32.cls:
::requires oodwin32.cls
Instances of the MessageExtensions class implement the methods listed in MessageExtensions Instance Methods table.
Table 13-1. MessageExtensions Instance Methods
Method... | ...on page |
---|---|
ConnectButtonNotify | ConnectButtonNotify |
ConnectComboBoxNotify | ConnectComboBoxNotify |
ConnectCommonNotify | ConnectCommonNotify |
ConnectEditNotify | ConnectEditNotify |
ConnectListBoxify | ConnectListBoxNotify |
ConnectListNotify | ConnectListNotify |
ConnectListViewNotify | ConnectListViewNotify |
ConnectScrollBarNotify | ConnectScrollBarNotify |
ConnectSliderNotify | ConnectScrollBarNotify |
ConnectTabNotify | ConnectTabNotify |
ConnectTreeNotify | ConnectTreeNotify |
DefListDragHandler | DefListDragHandler |
DefTreeDragHandler | DefTreeDragHandler |
>>-aMessageExtensions~ConnectCommonNotify(--id--,--"--+-OUTOFMEMORY-+--> +-CLICK-------+ +-DBLCLK------+ +-ENTER-------+ +-RCLICK------+ +-RDBLCLK-----+ +-GOTFOCUS----+ +-LOSTFOCUS---+ >--"--+---------------+--)------------------------------------->< +-,--msgToRaise-+
The ConnectCommonNotify method connects a particular WM_NOTIFY message for a dialog control with a method. The WM_NOTIFY message informs the dialog that an event has occurred with regard to a dialog control.
If a specific Connect...Notify method exists for the dialog control, use this method instead of the ConnectCommonNotify method because the system might send a specific notification instead of a common one.
The arguments are:
The ID of the dialog control of which a notification is to be connected to a method.
The event to be connected with a method:
The dialog control went out of memory.
The left mouse button was clicked on the dialog control.
The left mouse button was double-clicked on the dialog control.
The return key was pressed in the dialog item.
The right mouse button was clicked on the dialog item.
The right mouse button was double-clicked on the dialog control.
The dialog item got the input focus.
The dialog item lost the input focus.
The message that is to be sent whenever the specified notification is received. Provide a method with a matching name. If you omit this argument, the event is preceded by On.
The return codes are:
No error detected.
The resource ID could not be resolved or the event argument is incorrect.
The message was not connected correctly.
The following example connects the double-click of the left mouse button on dialog control DLGITEM1 with method OnDblClk:
::class MyDlgClass subclass UserDialog inherit MessageExtensions ::method Init self~init:super(...) self~ConnectCommonNotify(DLGITEM1, "DBLCLK") ::method OnDblClk use arg id say "Item" id " has been double-clicked!"
Note: Connections are usually placed in the Init or InitDialog method. If both methods are defined, use init as the place for this connection - but not before init:super has been called.