A post posted on the Forum some time ago. Of course, listview can also implement a hierarchical progressive tree structure. Although it is only appearance and cannot be folded and opened, it can be well implemented to apply the chekbox status to the subnode. As shown in the following figure:
The implementation method is also simple:
- // Apply the checked status of the item to the sub-project
- Procedure checksubitems (item: tlistitem );
- VaR
- I: integer;
- Begin
- For I: = item. index + 1 to listview1.items. Count-1 do
- If INTEGER (listview1.items [I]. Data)> INTEGER (item. Data) then
- Listview1.items [I]. Checked: = item. Checked
- Else
- Break;
- End;
In the above Code, listview1.items []. data can be considered to store level information (in fact, I use it for other purposes), where calls are needed
The checksubitems function can apply the chekbox status of the tlistitem to the subnode.
.