This control is sort of a cross between a grid and a list box. It's like a grid in that you can display rows and columns of data, but like a list box in that you can only select a row at a time, not individual cells.

To populate a dListControl, you must first set its column structure, and then append the rows of data you want. There is currently no way to change the caption of a column once it has been created, so specify the column caption in any of these methods:

addColumn(caption): appends a column to the end of the existing columns

insertColumn(position, caption): adds a column in specified position

setColumns(captionList): clears out any existing columns, and creates new ones with the specified list/tuple of captions.


Data is then added to the control by calling one of the following:

append(val, col=0): creates a new row with val in the specified column. If val is a list/tuple, the values will be set in the columns starting with the passed value of col. If either case results in an attempt to add to a column beyond those that have already been created, no error will be raised, but the value will be ignored.

appendRows(val, col=0): just like append(), but val should be a list/tuple of row elements. It is equivalent to calling append() once for each element in val.

insert(val, row=0, col=0) and insertRows(val, row=0, col=0): analogous to the append methods, except you can specify the row to use for the data.

removeRow(rownum): removes the specified row.


Some of the more useful properties:

ValueColumn - (int): This determines which column in a multi-column list is returned when the Value property is accessed. Default=0
Value - (str / list of str): Returns the text in the selected row that is in the column specified by ValueColumn?. If MultipleSelect? is True, it returns a list containing the value for each selected row.
ColumnCount - (int): Number of columns in the control.
RowCount - (int): Number of rows in the control. There is also a Count property; it's just an alias for RowCount.
HeaderVisible - (bool): Determines if the column headers are shown. Default=True.
HorizontalRules, VerticalRules (bool): Determine if the gridlines are shown in the respective directions.
MultipleSelect - (bool): When True, the user can select multiple rows.
SelectedIndices - (list of int): Returns a list containing the row numbers that are currently selected.

See the Dabo Class Documentation for an exhaustive documentation of this control's Properties and Methods.