Preventing a TreeView control from collapsing other nodes when selecting new node.
Posted on 2003-10-27
I am getting increasingly frustrated by a peculiar (seemingly default) behavior of the TreeView control (Common Controls 6 version).
Say for example I create a tree with 3 nodes at the root level and 3 child nodes for each parent node. I run the project and use the + / - symbols to expand all three parent nodes. As soon as I click on one of the child nodes, the parent nodes of the other child nodes automatically collapse, leaving the minimum number of expanded nodes needed to provide a path to the selected node.
This behavior doesn't seem to exist in any program on the market which uses TreeViews, even Windows Explorer, but I can't for the life of me work out how to prevent it. Surely this must be driving other developers mad, and yet I can find nothing about it anywhere on the web. Please help!
Behaviour definitely occurs under Windows 2000 and XP using Visual Basic 6, Service Pack 5.