Treeview with Checkboxes and other buttons #431
-
Hello, I am trying to make a tree-view like the one in the example code, however I would like to add check boxes and other buttons to each element of the tree following the text/label. In my case, I have three levels. The tree looks something like this: -File: filename All levels should have the same buttons, but only file and section should have drop downs like the children in the tree view example. I am currently using the same struct for file and part, and I am making a Parts array within the Section struc. This currently is not working, I am getting lock value errors. How would I implement this correctly? Any help is greatly appreciated. Thank you, Update: I have fixed the lock value errors by using pointers, and a treeview appears for me. While the file has the dropdowns containing the sections, the sections don't have drop downs, I still can't get the checkboxes to appear, and the parts are not showing up at all. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
You probably want to build on the existing TreeView and just re-write the ConfigParts* related code to add your special buttons etc to the nodes. The "Parts" for a TreeView widget should only contain the elements in a single node, whereas you can use conditional formatting code to configure your custom TreeView widget to render the different levels properly. If that doesn't work, then you'll have a different design from TreeView, and should write from scratch on top of PartsWidgetBase. Check out the FileTreeView for an example that builds on the base TreeView -- it doesn't add any additional parts though, but shows how to add onto the existing widget. |
Beta Was this translation helpful? Give feedback.
-
Great to hear that you got it mostly working. Node2D defines a set of ContextMenu* methods, and Widget has a |
Beta Was this translation helpful? Give feedback.
-
The property names are the names of the methods that will be called when those menu items are called, and the receiver on the method call will be the node widget, so from the node widget, you could just call the SetInvisible() method directly? The updtfunc is for updating the inactive state of the menu, so if you need that, the first arg passed on that method is the node, and the second is the action -- see the code in filetree.go for example -- so you have the info there. |
Beta Was this translation helpful? Give feedback.
-
that Name: "ClearInvisible" prop means it will call the "ClearInvisible" method -- that is operating on the TreeView item itself, and that method only clears the flag, unless you changed it. In any case, the key point is that youre naming a method to call, and in that method, you have full access to e.g., the Name() method on the TreeView that got called, and that should give you what you want, right? |
Beta Was this translation helpful? Give feedback.
that Name: "ClearInvisible" prop means it will call the "ClearInvisible" method -- that is operating on the TreeView item itself, and that method only clears the flag, unless you changed it. In any case, the key point is that youre naming a method to call, and in that method, you have full access to e.g., the Name() method on the TreeView that got called, and that should give you what you want, right?