OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

How to do Multi Columns in a TListWindow

Date: 12/1/99
Time: 10:25:07 PM

Question:

How do I use a TlistWindow, and display multi columns in the control?

Answer:

In order to display more than one column, you need to do a couple things:
First you will need to create the TListWindow, with more that one column, for example:

    TListWindow list;
    list.InsertColumn(0, TListWindowColumn("First Column", 100));
    list.InsertColumn(0, TListWindowColumn("Second Column", 100));

Next you will need to insert items, that have more than one column, for example:

    TListWindItem item("Item Text");
    list.InsertItem(item); // Fill in the second column
    item.SetSubItem(1);
    item.SetText("Column 2");
    list.SetItem(item);

The columns will only show up when the list is displayed in detail mode, for example:

list.ModifyStyle(LVS_TYPEMASK, LVS_REPORT);

Last changed: July 14, 2001