ConnectListNotify

>>-aMessageExtensions~ConnectListNotify(--id--,--"--+-ACTIVATE----+--"-->
                                                    +-BEGINDRAG---+
                                                    +-BEGINRDRAG--+
                                                    +-BEGINEDIT---+
                                                    +-ENDEDIT-----+
                                                    +-DEFAULTEDIT-+
                                                    +-CHANGING----+
                                                    +-CHANGED-----+
                                                    +-COLUMNCLICK-+
                                                    +-DELETE------+
                                                    +-DELETEALL---+
                                                    +-INSERTED----+
                                                    +-KEYDOWN-----+

>--+---------------+--)----------------------------------------><
   +-,--msgToRaise-+


The ConnectListNotify method connects a particular WM_NOTIFY message for a list view control with a method. The WM_NOTIFY message informs the dialog that an event has occurred in the list view.

Arguments:

The arguments are:

id

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

event

The event to be connected with a method:

ACTIVATE

An item is activated by double-clicking the left mouse button.

BEGINDRAG

A drag-and-drop operaton was initiated. See DefListDragHandler for information on how to implement a drag-and-drop handler.

BEGINRDRAG

A drag-and-drop operaton involving the right mouse button was initiated. See DefListDragHandler for information on how to implement a drag-and-drop handler.

BEGINEDIT

Editing a label has been started.

ENDEDIT

Label editing has ended.

DEFAULTEDIT

This event connects the notification that label editing has been started and ended with a predefined event-handling method. This method extracts the newly entered text from the notification and modifies the item of which the label was edited. If this event is not connected you must provide your own event-handling method and connect it with the BEGINEDIT and ENDEDIT events. Otherwise, the edited text is lost and the item remains unchanged.

When you specify this event, omit the msgToRaise argument.

CHANGING

An item is about to change. This notification is sent before the item is changed.

CHANGED

An item has changed. This notification is sent after the item changed.

COLUMNCLICK

A column has been clicked.

DELETE

An item has been deleted.

DELETEALL

All items have been deleted.

INSERTED

A new item has been inserted.

KEYDOWN

A key was pressed inside the list view. This notification is not sent while a label is being edited.

msgToRaise

The message that is to be sent whenever the specified notification is received from the list view control. 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 column-clicked event for the list view EMPLOYEES with method ColumnAction and changes the style of the list view from REPORT to SMALLICON:

::class MyDlgClass subclass UserDialog inherit MessageExtensions

::method Init
  self~init:super(...)
  self~ConnectListNotify("EMPLOYEES", "COLUMNCLICK", "ColumnAction")

::method ColumnAction
  use arg id, column
  lc = self~GetListControl("EMPLOYEES")
  lc~ReplaceStyle("REPORT", "SMALLICON EDIT SINGLESEL ASCENDING")
  if column > 0 then ...

  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 method connected to ENDEDIT receives two arguments: the item ID of which the label has been edited and the newly entered text.

    Example:

    ::method OnEndEdit
      use arg item, newText
  3. The event-handling method connected to COLUMNCLICK receives two arguments: the control ID of the list view control and the zero-based column number of which the header button was pressed.

    Example:

    ::method OnColumnClick
      use arg id, column
  4. The event-handling method connected to KEYDOWN receives two arguments: the control ID of the list view control and the virtual key code pressed. Use the method KeyName of the VirtualKeyCodes class to get the name of the key. Note that your class must inherit from the VirtualKeyCodes class to use the KeyName method.

    Example:

    ::method OnKeyDown
      use arg id, vkey
      say "Key" self~KeyName(vkey) "was pressed."
  5. The event-handling method connected to BEGINDRAG or BEGINRDRAG receives three arguments: the control ID of the list view control, the index of the list item to be dragged, and the point where the mouse cursor was pressed (x and y positions, separated by a blank).

    Example:

    ::method OnBeginDrag
      use arg id, item, where
      say "Item at index" item "is in drag-and-drop mode"
      parse var where x y
      say "The drag operation started at point ("x","y")"