Coupling an MFC CListCtrl and CTreeCtrl to get a view of the whole tree, not just one node at a time

Posted by omatai on Stack Overflow See other posts from Stack Overflow or by omatai
Published on 2010-05-25T22:15:23Z Indexed on 2010/05/25 22:21 UTC
Read the original article Hit count: 260

Filed under:
|
|

Consider Windows Explorer (or regedit or similar). To the left side, there is a tree view, and to the right, a list view. In all cases I know of, the contents of the right view reflect the attributes of the selected node from the left pane. This is all well and good... but just not what I want.

The nodes of the tree I want to display have a very few attributes (2-3) associated with each node - a reasonable amount to display horizontally as a row in a table. Rather than waste all that list view space on a single node with very few properties, I would like to have my list view display a table of the whole tree's properties (as the part of the tree currently expanded). So the nth line in the left view (tree) will correspond directly to the nth line in the right view (list/table), and I will get a decent overview of the properties of my tree.

Does anyone know of code that does this? I am guessing that slaving a CListCtrl to a CTreeCtrl would be the way to go, and somehow overriding the vertical scrolling functions so that they are locked together. I'm just not sure that it is possible to lock the scrolls together like this... among other things! All advice gratefully welcomed :-)

© Stack Overflow or respective owner

Related posts about c++

Related posts about mfc