delphivirtualtreeview

Multiple Expanding Nodes in Virtual TreeView possible?


I am using a TVirtualStringTree (part of the Virtual TreeView Component) in my Delphi project and I would like to create a view where 2 columns can have children that are expandable/collapsable with [+] sign. In the picture below as sample I would like to have a [+] sign in the Server Column but also in the Image column. The idea is that the tree has several Server nodes that each have many process child's (which main colum is image) and some processes have sub-processes which are children of the processes'node.

alt text
(source: remkoweijnen.nl)

Is such a layout possible? If not with the default component I would appreciate advice on how to implement this in a descendant.

/Edit: The following screenshots are when using the method TOndrej suggests: alt text http://www.remkoweijnen.nl/temp/TreeView2.png alt text http://www.remkoweijnen.nl/temp/TreeView3.png alt text http://www.remkoweijnen.nl/temp/TreeView4.png

OK, I decided to implement as per TOndrej's idea: alt text http://www.remkoweijnen.nl/temp/TreeView5.png


Solution

  • You most probably don't need that. Just make yourself a clear specification of what grouping you need. The first column can be multi-purpose - showing different information on each grouping level - e.g. level 0: server, level 1: process, level 2 and higher: child process. On each level, only columns relevant to that level need to display any information. In the above example, level 0 would only display the server name in the first column; the rest of the columns would remain empty.

    You could probably implement as many plus signs as you want by custom-drawing but it would be a lot of work and I really think the result is unnecessary, unusual and easily confusing to the user.