New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to recursively fold all TreeNodes? #1131
Comments
don't call it every frame |
@ratchetfreak I don't understand. I'm already not calling it every frame, only when the user clicks the "fold tree" button. |
@liorda Please explain what you are trying to do in more clarity, it is hard to understand at the moment.
So Except this will create many '0' entries in the storage for tree nodes that haven't been touched, so it will grow the storage unnecessarily, which is not desirable. So you can do
( |
Sorry for being vague, I'll try to explain better: @ocornut I wasn't aware of |
OK, that was pretty easy. All I needed to do was change the Show function to:
I have no idea what's the best way to allow this with the current api style. Maybe a new flag to |
I tried the solution proposed by @liorda, but in my test (Linux, SDL/OpenGL2, as I'm still on old hardware), it does a quick, one frame "glitch" where all the nodes are temporarily all open. This is most noticeable when the tree is already collapsed. To test, paste that code in the demo or other working code:
Is there an equivalent way to achieve the same effect without this "glitch"? |
I want to add a tree view with the default open and I want it to collapse or hide when clicking over a tree node. Since I have to keep all opened I set ImGui::SetNextItemOpen(true); for every instance. Then I cannot get the functionality of hiding the view. |
…Here now goes through proper navigation logic: honor scrolling and selection. (#1079, #1131) Added a stack for this purpose which other features might build on (e.g. #2920). However this is currently gated by many tests and not a performance concern, but making stack happen all the time may be undesirable.
…Here now goes through proper navigation logic: honor scrolling and selection. (ocornut#1079, ocornut#1131) Added a stack for this purpose which other features might build on (e.g. ocornut#2920). However this is currently gated by many tests and not a performance concern, but making stack happen all the time may be undesirable.
I suggest adding a way to process a tree node without showing it, either via a flag or sth like This solution is generic to all similar problems. For example, Filtering a tree, i.e., hiding all nodes of intermediate levels. |
I can use
ImGui::SetNextTreeNodeOpen(false);
, but if I do, the node's children won't be expanded so I won't be able set their open state...Is there anyway to access the internal tree behavior?
Thanks!
The text was updated successfully, but these errors were encountered: