I have a desktop app with a hierarchal ListBox (disclosure triangles / +) to expand the indented row below it.
Is there any way to expand all of the rows without having to repeatedly loop and walk the list to expand every unexpanded row until there are no more to be expanded?
For a reasonalble # of rows, speed should not be an issue.
If you have THAT many entries, perhaps the UI needs to be rethought?
BTW I provide that on my listbox subclass, I also provide a way to expand the subtree for a specific node, and use it when the user option-clicks on the disclosure widget.
That seems something that the listbox should support out of the box.
Yup, I got that. So if you want to recursively expand, work top-down. But if you only want the first level expanded, word bottom-up so it doesn’t enter the newly-expanded rows. Or did I miss something?
Personally, I prefer using the Einhugur TreeView control for things like this. You can lock the drawing while building the list and set whether or not it’s expanded during that time. Since all the nodes are memory persistent you can load once and forget. I also think it looks better but that’s just my opinion. It doesn’t have as many buzzers and bells as the built-in listbox so it really does depend on what features you need.