Interface

TableDataSource

Table Data Source


Description

The minimal data source for a DesktopTable.

Assign an object implementing this interface to DesktopTable.DataSource and the table stops storing rows of its own: it asks the source for the row count and for the text of the cells it is about to draw, so the cost of a frame depends on the visible cells only, not on the size of the data set.

CellTextAt is called once per visible cell per frame, so it should be a plain lookup. Every other state - selection, row heights, cell styles, tags - stays with the table and is kept per row index. After the underlying data changes, call DesktopTable.ReloadFromDataSource.

Methods

Name

Parameters

Returns

Shared

CellTextAt

row As Integer, column As Integer

String

RowCount

Integer

Method descriptions


TableDataSource.CellTextAt

CellTextAt(row As Integer, column As Integer) As String

Text of a cell, 0-based. It is called once per visible cell per frame, so it should be a plain lookup: an array or dictionary access, never a query or a conversion.

This example maps the column index onto the fields of a record:

Select Case column
Case 0
  Return mRows(row).Name
Case 1
  Return mRows(row).City
End Select

TableDataSource.RowCount

RowCount As Integer

Number of visible rows. It is asked while drawing and while hit testing, so it should be a field read rather than a computation.

This example returns the size of the record store:

' Called while drawing and while hit testing, so keep it a field read
Return mRows.Count

Compatibility

Project Types

Desktop

Operating Systems

All