See your forest-through-the-trees with the TreeView control. This new control makes it easy to display information in a hierarchical fashion and expand and hide nested rows at runtime. Like the ListBox, the TreeView control uses many of the same control properties and VBA Language Extensions, but also uses a new variable type called “vbaRow”.
The Bill of Materials Pick List is an example generated from the TreeView control. It’s a Bill of Materials for assembling a "Waterfall Picture Kit" and shows the location of the parts and materials.
The parent rows (rows which will contain child rows) are constructed by declaring the row names as “vbaRow” and by using the Set command to specify where the parent is added.
Here are the steps for how the rows and sub-rows were created:
- Declare your rows using the ‘DIM row name as vbaRow’.
2. Create the parent row by calling the prompt’s List.AddItem extension. To create the child/sublevel, call AddItem from the vbaRow returned by the prompt’s List.AddItem call.
Note: The pointer () prompt is added automatically when child nodes are created.
3. Add additional items using the method of your choice.
4. Repeat steps 2 through 3 for the other items.
5. The TreeView control also includes a new property group for stylizing columns. If you click on Columns, the Manage Object Column Sets property displays. If desired, you can create and save multiple ColSets and apply them for purposes such as localization.
The example below shows one column setting “ColSet0,” where the Column 0 Caption was set to “Sort by: Location.”