.topic ctrl.listview
.title ListView
.toc 1 Data Display Controls
.toc 1 ListView
.index ListView
.index Multi-Column List
.index SetColumns
.index SetSort

.h1 ListView

VB Equivalent: ListView -- DVX Widget: listview

A multi-column list with column headers. Supports sorting, multi-select, and drag-to-reorder.

.h2 Type-Specific Properties

.table
  Property    Type      R/W   Description
  ---------   -------   ---   -------------------------------------------
  ListIndex   Integer   R/W   Index of the currently selected row (-1 = none).
.endtable

.h2 Type-Specific Methods

.table
  Method                                        Description
  ------                                        -----------
  AddItem text$                                 Add a row (sets first column text).
  Clear                                         Remove all rows.
  ClearSelection                                Deselect all rows.
  GetCell$(row%, col%)                          Returns the text of a cell.
  IsItemSelected(index%)                        Returns True if the row is selected.
  RemoveItem index%                             Remove a row by index.
  RowCount()                                    Returns the number of rows.
  SelectAll                                     Select all rows.
  SetCell row%, col%, text$                     Set the text of a cell.
  SetColumns spec$                              Define columns. Pipe-delimited "Name,Width|Name,Width" (width in characters).
  SetItemSelected index%, selected              Select or deselect a row.
  SetMultiSelect multi                          Enable or disable multi-select.
  SetReorderable reorderable                    Enable or disable row reordering.
  SetSort col%, dir%                            Sort by column. dir: 0=none, 1=ascending, 2=descending.
.endtable

Default Event: Click

.h2 Example

.code
ListView1.SetColumns "Name,20|Size,10|Type,15"
ListView1.AddItem "readme.txt"
ListView1.SetCell 0, 1, "1024"
ListView1.SetCell 0, 2, "Text"
ListView1.SetSort 0, 1
.endcode

.link ctrl.common.props Common Properties, Events, and Methods
