Building a tree lookup
Form tree controls are a user-friendly way of displaying a hierarchy of related records, such as a company's organizational structure, inventory bill of materials, projects with their subprojects, and so on. Such hierarchies can also be displayed in the custom lookups, allowing users to browse and select the required value in a more convenient way.
In the Using a tree control recipe in Chapter 2, Working with Forms, it was explained how to present the budget model hierarchy as a tree in the Budget model form. In this recipe, we will reuse the previously created BudgetModelTree class, and will demonstrate how to build a budget model tree lookup.
How to do it...
1. In the AOT, create a new form named BudgetModelLookup. Set its design properties as follows:
Property
Value
Frame
Border
WindowType
Popup
2. Add a new
Tree
control to the design, with the following properties:Property
Value
Name
ModelTree
3. Add the following line to the form's class...