From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
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.
The following example adds expandable rows. Note that AddExpandableRow must be called to create the hierarchical relationship.
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)
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