From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

DesktopListBox.AddExpandableRow(text as String)

New in 2021r3

Supported for all project types and targets.

Appends text in a new row to the end of the list and adds disclosure triangle only if the AllowExpandableRows property is set to True.


When configured to have more than one column, Item is always assigned to column zero. In the case where AllowExpandableRows is True, AddExpandableRow adds Item to the subitems of the expanded row when called in the RowExpanded event.

Sample Code

The following example adds expandable rows. Note that AddExpandableRow must be called to create the hierarchical relationship.

Var s1, sub1 As String
Me.ColumnWidths = "150,0"
s1 = "Michigan,Ohio,Minnesota"
sub1 = "Grand Blanc,Bad Axe,Flint,Benton Harbor,"_
+ "Detroit;Cleveland,Columbus,Akron,Pleasantville;St. Paul,Frostbite Falls"
For i As Integer = 1 To s1.Split(",").Count
If NthField(sub1, ";", i) <> "" Then
Me.CellTextAt(i - 1, 1) = sub1.NthField(";", i)
End If
Me.CellTextAt(i - 1, 0) = sub1.NthField(",", i)
Me.ColumnCount = 1

See the section “Hierarchical Rows” in the Notes section for illustrations of the expanded and collapsed states.

Volume Browser Example

The FileBrowser example project displays the file structure of the user's drive as a hierarchical control using a custom subclass. The Opening event of the custom class builds the hierarchical list using AddExpandableRow in a For...Next loop for all of the mounted volumes.

You can find this in the Examples folder: Examples/Files/FileBrowser