ConnectListBoxNotify

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

Arguments:

The arguments are:

id

The ID of the list box of which a notification is to be connected to a method.

event

The event to be connected with a method:

DBLCLK

An entry in the list box has been selected with a double click.

ERRSPACE

An out-of-memory problem has occurred.

GOTFOCUS

The list box got the input focus.

LOSTFOCUS

The list box lost the input focus.

SELCANCEL

The selection in the list box has been canceled.

SELCHANGE

Another list box entry has been selected.

msgToRaise

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.

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

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

  2. 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")
      ...