I have a hierarchical listbox that displays information about devices. As such, I only want to allow one device row to be expanded. This means that I need to collapse any row that may be open above or below the current row.
Using the CellClick even and checking for x < 18 lets me trap the expand versus normal click, but when I then walk through the rows to collapse any other rows, the selected row’s “row” value changes and things get mixed up when there are more than 3 or 4 devices in the list.
Has anyone else worked out the logic for collapsing expanded rows before expanding the currently selected row?
I feel like the UX on an accordion in a listbox would turn out quite poor. The expectation for collapsible rows in a listbox for users is that they can open or close however many they want. If you want to display details for one device at a time I would recommend a list/viewer combo. Think Disk Utility.app
[quote=355856:@Jeff Tullin]1/ Clear rowtags of all rows
2/ Set rowtag of the current row to
3/ collapse everything
4/ expand the row that has the rowtag[/quote]
I totally forget the power or row/cell tags when I’m running at full speed. Thanks.
Because of the complex nature of the information to be displayed, there would be too much info if they were all left expanded. Users already don’t understand how tape works on a computer. I’m trying to do what ever I can to remove some of the confusion.
But - there is far less info for a disk than I have to deal with for a tape drive. However, I am looking at what I could accomplish in that same manner.
That’s why I’ve abstracted all that logic in a reusable subclass…
No, but I think it would be possible quite easily (even though I don’t like the idea).
My approach is to have a custom Class respresenting a hierarchical list.
That list is assigned to a (subclassed) Listbox, which handles all the expanding/collapsing.
One can at any time update the statuses (such as ‘expanded/collapsed’) in the hierarchical List and just update the Listbox to reflect the new status.
If you want to have a look at such an approach: Here’s my TreeView.
In the Expanded event, why not add your content and then go through the listbox backwards and call Expanded(row) = False for any rows except the current one where Expanded(row) = True?
In the Expanded event, why not add your content and then go through the listbox backwards and call Expanded(row) = False for any rows except the current one where Expanded(row) = True?[/quote]
Tried that - since I may need to collapse folders above or below the current selection, the row changes as the earlier folders are collapsed. Using RowTag worked perfectly as @Jeff Tullin mentioned but it turns out that using a list “Navigator” with a data display area is a better design for achieving the effect I’m looking for.