Listbox to display hierarchy

I have a database holding a linked list
I want to represent this visually as a hierarchical listbox.

I select ‘level 1’ items and use addrow to display them.
If someone expands one of these rows, I expect to select children of that row from the database, and add those as children of the expanded row.
The children should be in alphabetical order.

maybe one of those children is expanded too.

Now, a level1 item is closed, and expanded again.
It had children already, but by now there may be more of them. Some may have been deleted.

Whats the best way to bring the expanded contents into line with the database?

delete all the children and recreate?
try to see which may not exist any longer and delete them, then add any missing ones?

And while Im at it, how do you examine the children of a row of a hierarchical listbox?
Unless Im missing something, there doesnt seem to be a distinct ‘row’ object that can have children.
I suspect Im thinking of an actual treeview control I used years ago… not the same animal?

look at the hierarchical example in the examples folder, there is a full working hierarchical listbox.

I cant find a hierarchical example.
But I’ll bet that it shows how to display/populate a hierarchy and stops there, not showing how to amend and refresh it afterwards…

Whats it called? I see nothing in the Listbox folder that says ‘hierarchy’

If you want a “fancy” one…

http://www.rdS.com/treeview/

I like yours very much Dave, I downloaded it a while back (thought Id bought it but cant trace a receipt)

But you back it with a linked list of your own construct, which is great for creating from scratch, but the code is complex (read: impressive)

Im not quite sure how to replace or mirror that with a database as the backing storage.

I don’t quite follow. You have to build the child rows from scratch every time you expand a row, so wouldn’t you be going to the database every time anyway?

I have used Einhugur’s TreeView for Fonts Manager. It is simple to use and I like being able to pick the icons I want for folders.

http://einhugur.com/Html/Grids.html

There are a couple:

  • Desktop/Controls/ListBox/ListBoxExample (run it and click the Hierarchical tab)
  • Text/XMLExample (displays XML data in a hierarchical listbox)

[quote=318446:@Jeff Tullin]I cant find a hierarchical example.
But I’ll bet that it shows how to display/populate a hierarchy and stops there, not showing how to amend and refresh it afterwards…

Whats it called? I see nothing in the Listbox folder that says ‘hierarchy’[/quote]
it’s called “filebrowser” in examples/desktop/controls/listbox.