>>-aMessageExtensions~ConnectListBoxNotify(--id--,--"--+-DBLCLK----+--"--> +-ERRSPACE--+ +-GOTFOCUS--+ +-LOSTFOCUS-+ +-SELCANCEL-+ +-SELCHANGE-+ >--+---------------+--)------------------------------------------------->< +-,--msgToRaise-+
The ConnectListBoxNotify method connects a particular WM_NOTIFY message for a list box with a method. The WM_NOTIFY message informs the dialog that an event has occurred in the list box.
The arguments are:
The ID of the list box of which a notification is to be connected to a method.
The event to be connected with a method:
An entry in the list box has been selected with a double click.
An out-of-memory problem has occurred.
The list box got the input focus.
The list box lost the input focus.
The selection in the list box has been canceled.
Another list box entry has been selected.
The message that is to be sent whenever the specified notification is received from the list box. 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 the text of the selected list box entry:
::class MyDlgClass subclass UserDialog inherit MessageExtensions ::method Init self~init:super(...) self~ConnectListBoxNotify("MYLIST", "SELCHANGE", "SelectionChanged") ::method SelectionChanged li = self~GetListBox("MYLIST") say "New selection is:" li~Selected
Notes:
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 list box (extract the low-order word) and the handle to the list box. Example:
::method Handler use arg ev_id, handle id = BinaryAnd(ev_id, "0x0000FFFF") ...