OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
About the List View Control

The TListViewCtrl class creates a list view that displays items in four ways: large (regular) icons, small icons, as a list, or as a report.

In-place editing of item names is supported. The right pane of the Windows 95 Explorer uses this type of window.

The native control for Windows 95 is the List View common control.

Using the List View Control

  1. #include <owl/listviewctrl.h> for declarations of TListViewCtrl, TListWindItem, and TListWindColumn classes.
  2. Create the control.
    ListWind = new TListViewCtrl(this, ListWindId, 40, 40, 400, 200);
  3. Set the style for the control.
  4. Optionally associate an image list with the control. If you are using an image list, do not forget to #include <owl/imagelst.h>.
    ListWind->SetImageList(*ImageList, TListViewCtrl::State);
  5. Depending on the style of the control, add the appropriate columns.
    TListWindColumn column("Column", 100);
    ListWind->InsertColumn(0, column);
  6. Add the items into the control.
    for (int i = 0; i < ImageList->GetImageCount(); i++) {
    sprintf(Buffer, "Item %d", i);
    TListWindItem item(Buffer);
    item.SetStateImage(i);
    ListWind->InsertItem(item);
    }
  7. The parent window of the control may respond to events sent by the control.