How do I add a folder and then add a row with a listbox. I presume I am meant to use InsertRow but how do I know the index of the last inserted folder. Is there something like this in the docs other than the one that uses NthField.
I see this:
Hierarchical ListBoxesCreating a simple hierarchical ListBox is more involved than a two-column ListBox because you must manage hiding and displaying the sublist data. A simple way to do this is to assign the sublists to a “hidden” column in the ListBox and toggle the display of that data when the user double-clicks on a “parent” element.
You create a row with a disclosure triangle using the AddFolder method (rather than the AddRow method) and then set the Hierarchical property to True. See the Example for a simple hierarchical ListBox with one level.
From Xojo docs
Is there an API that makes what I am trying to achieve more convenient or am I underestimating the convenience of the technique above.
Well, that does work, but that’s not what I recommended. As I posted, use AddRow, not InsertRow, and they will be added as subrows to the main folder row, indents and all. And you won’t need the code in CollapseRow either as that will be taken care of for you.