>>-aMessageExtensions~ConnectButtonNotify(--id--,--"--+-CLICKED---+--"--> +-DBLCLK----+ +-DISABLE---+ +-GOTFOCUS--+ +-LOSTFOCUS-+ +-HILITE----+ +-UNHILITE--+ +-PAINT-----+ >--+---------------+--)---------------------------------------->< +-,--msgToRaise-+
The ConnectButtonNotify method connects a particular WM_NOTIFY message for a button control (push button, radio button, or check box) with a method. The WM_NOTIFY message informs the dialog that an event has occurred with regard to the button.
Note: In order to recieve the GOTFOCUS, LOSTFOCUS, and DBLCLK events, the button control has to have the NOTIFY (BS_NOTIFY) style. For user defined dialogs use the NOTIFY style keyword in the Add... method when the button is defined. For dialogs created from a compiled resource or a resource script file use the BS_NOTIFY style for the button resource. The other events are always sent and it is not necessary to add the NOTIFY style.
The arguments are:
The ID of the button control of which a notification is to be connected to a method.
The event to be connected with a method:
The button has been clicked.
The button has been double-clicked.
The button has been disabled.
The button got the input focus.
The button lost the input focus.
The button has been selected.
The highlighting is to be removed (lost selection).
The button is to be repainted. This notification is only sent for owner-drawn buttons.
The message that is to be sent whenever the specified notification is received from the button control. 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 displays a message whenever the OK button is selected:
::class MyDlgClass subclass UserDialog inherit MessageExtensions ::method Init self~init:super(...) self~ConnectButtonNotify("OK", "HILITE") ::method OnHilite say "The OK button has been selected"
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.
The event-handling methods receive two arguments: the ID of the button (extract the low-order word) and the handle to the button. Example:
::method Handler use arg ev_id, handle id = BinaryAnd(ev_id, "0x0000FFFF") ...