Chapter 13. MessageExtensions Class

Table of Contents
ConnectCommonNotify
ConnectTreeNotify
DefTreeDragHandler
ConnectListNotify
DefListDragHandler
ConnectListViewNotify
ConnectButtonNotify
ConnectEditNotify
ConnectListBoxNotify
ConnectComboBoxNotify
ConnectScrollBarNotify
ConnectTabNotify
ConnectSliderNotify

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

Requires:

The MessageExtensions class requires the class definition file oodwin32.cls:

::requires oodwin32.cls

Methods:

Instances of the MessageExtensions class implement the methods listed in MessageExtensions Instance Methods table.

Table 13-1. MessageExtensions Instance Methods

Method......on page
ConnectButtonNotifyConnectButtonNotify
ConnectComboBoxNotifyConnectComboBoxNotify
ConnectCommonNotifyConnectCommonNotify
ConnectEditNotifyConnectEditNotify
ConnectListBoxifyConnectListBoxNotify
ConnectListNotifyConnectListNotify
ConnectListViewNotifyConnectListViewNotify
ConnectScrollBarNotifyConnectScrollBarNotify
ConnectSliderNotifyConnectScrollBarNotify
ConnectTabNotifyConnectTabNotify
ConnectTreeNotifyConnectTreeNotify
DefListDragHandlerDefListDragHandler
DefTreeDragHandlerDefTreeDragHandler

ConnectCommonNotify

>>-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.

Arguments:

The arguments are:

id

The ID of the dialog control of which a notification is to be connected to a method.

event

The event to be connected with a method:

OUTOFMEMORY

The dialog control went out of memory.

CLICK

The left mouse button was clicked on the dialog control.

DBLCLK

The left mouse button was double-clicked on the dialog control.

ENTER

The return key was pressed in the dialog item.

RCLICK

The right mouse button was clicked on the dialog item.

RDBLCLK

The right mouse button was double-clicked on the dialog control.

GOTFOCUS

The dialog item got the input focus.

LOSTFOCUS

The dialog item lost the input focus.

msgToRaise

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.

Return value:

The return codes are:

0

No error detected.

-1

The resource ID could not be resolved or the event argument is incorrect.

1

The message was not connected correctly.

Example:

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.