I am working on a desktop application for Mac. I have a listbox displaying a treeview with checkboxes in each cell. I can’t figure out how to make the app behave so that if the checkbox is true on a folder, then all the child items of that folder also get selected or deselected. Any help would be greatly appreciated.
You need to find the visible child items and then do the checkbox. What have you tried so far?
What do not works actually ?
Nota: to collapse an entry, the user have to click in the Black triangle in the “folder” (a Row added using Lstbox1.AddFolder, an entry that represent a colder in your case).
Did you looked at this example:
Did you check my example (search hierarchical Listbox in the forum, October 2017) ?
Try this short sample project:
Simply said: on ExpandRow set some information which one is the parent folder.
On CellAction on a parent folder loop through the child elements and set the CellCheck to the same value.
The Xojo provided example is far more speaking: it display real HD data.
But there are no checkboxes ;-).
Yes, and I do not understand the need for them.
To “open” a hierarchical Listbox Row, a simple click in the black triangle is enough…
Because he wants / needs them for any reason:
Good answer, but he may not know he do not need CheckBoxes.
Select all: I do not see that on Windows.
Edit: same under macOS (10.13.3)
Sorry for the delayed response, had to get some shut-eye.
Beatrix: I have tried a couple of things, but I just don’t know how to do it. I have been banging my head on this for days with no luck. That is why I have turned to the forum.
Emile: I do now what I need. The application is one where the user can traverse the hierarchical listbox and select (check) specific folders and have the visual indication that the folder and its subitems and that only those items get copied to another location. I have the ExpandRow function working.
This functionality exists in many Computer Forensics software applications.
Did you try my sample project?
Add a CheckBox in Column 1 for each Row ?
Stefan: I just downloaded your sample project and will look at it in a moment.
Emile: I have a checkbox added to the column already. I just need to know how to make the checkbox state go to checked for all children of the initially selected folder.
You can get an eye on the Listboxs Selected entry too.
I am sorry, I do not really understand what you want to do enough to help more than that, sorry.
Because the built in Hierarchical listbox does not have persistent data you’ve got to have a bunch of structures in place to make sure that if a row is checked or unchecked that when you expand the row it knows to do the right thing. That can get hairy.
Personally, I’d use Einhugur TreeView control because of its persistent data and the ability to dive deep in the node structure without having to worry about if data is going to go away or not. Very good for these sorts of things and well worth the money, in my opinion.
As far as I remember the Einhugur Treeview has the wanted behaviour out of the box. I needed a different behaviour and had to roll my own checkboxes.
This example might help:
Bob: If I can’t figure out a solution in relatively quick order, I will invest in the Einhugur Treeview.
Jason: I just downloaded the example you provided and will look at that this evening.
That’s why I’m using a hierarchical list to represent a Tree-structure. A custom Listbox-subclass then just displays what’s in there.
But one can use all list-content (even if currently not visible, of course also outside of the Listbox), modify it, refresh the Listbox to show the modifications in the list. It would be quite simple to fill that list to represent the folders/files.
So here is yet another TreeView example
Of course one would need to add support for the checkboxes (add a Property for that in the Tree-List-structure, show it accordingly in the Listbox). But maybe someone can use this as an idea in order to simplify and separate data and listbox-behavior-stuff. Especially when for some reason one can’t or don’t want to use a Plugin.