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.


The arguments are:


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


The event to be connected with a method:


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


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


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.


Editing a label has been started.


Label editing has ended.


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.


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


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


A column has been clicked.


An item has been deleted.


All items have been deleted.


A new item has been inserted.


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


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:


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 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~ConnectListNotify("EMPLOYEES", "COLUMNCLICK", "ColumnAction")

::method ColumnAction
  use arg id, column
  lc = self~GetListControl("EMPLOYEES")
  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.


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


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


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


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