-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Hide arrow on TreeNode and Collapsibles when children are empty #324
Comments
You can use BulletText() / Bullet() for that ? |
Indent()/Unindent() ? All those things are variations around a same thing. It's trivial to create a custom helper if you need a different behavior. |
The issue with indent is that it doesn't keep the labels at the indent computes for the bullet/expand arrow graphic. As soon as you start on a selectable treenode this behavior will probably be what you want as well. Anyway it's fine, like you say. With 1.45 I can trivially add this behavior myself now. |
I'm a little confused, could you elaborate with a more detailed example? |
Sure! Common convention in tree views is to not provide an expander if there are not children to expand while obviously keeping all the text/icons aligned as though the expander was there. You can find this behavior in Windows Explorer, OSX and the Hierarchy view in Maya for example This is a screen grab of a simple scene graph in our game. You'll notice that there are a number of nodes expanded yet do not have any children and are therefore kind of misleading. Here's an example where I've caught most of them but again using my cheat by just inserting 3 spaces before a normal text widget when there are no children |
So I suppose the problem here is that although you can do it with Indent(), you'd have to Indent/Unident manually for each item depending on whether the item is a tree node or not. Not a big problem for generated UI but still a still cumbersome and feels unnecessary?
I'll have to think of a solution on how to handle that neatly, I don't really know yet. If you have a suggestion. |
The solution might to just change how tree node behave to follow this standard but that would require to start from an indented position for a first tree node to be consistent (aka tree node shows on the LEFT of the current cursor position). It's also less flexible for quick layout. |
No, not at all. Using indent would be perfectly fine. However if you collapse Loxel Entities, There is actually a miss alignment on the labels. Basically what I'm proposing is a flag on collapsible header prevents it from expanding and hides the arrow (something to the effect of "ImGui_DisableCollapse". Or a bullet text that can have an empty bullet I guess, but It seems like it should really just be on the collapsible. |
So my current approach has been to simply make a copy of the BulletTextV and comment out the
|
FYI @kylawl I have fixed a bug today with indenting within trees with might affect your code - not specifically related to the main topic of this thread, but on your property widget. I am not sure how you got the right column to align correctly in this screenshot, did you reposition the cursor on the X axis? What does the code looks like? Anyway, if you have time to double-check it with the latest fixes it'd be super helpful. Thanks :) |
For each time I enter the right hand column I call ImGui::PushItemWidth(-1.0f); What I ended up doing for the label was just copying the collapsible header and removing the rendering of the arrow
|
Looking at this today along with several other TreeNode related issues, and I think what we could do is add a flag, .e.g Just theorizing at this point, I'm looking at all those Tree issues and trying to come with a general design. (exact details left to be decided). |
I managed to get a version of TreeNodeEx working, which took some flags and On Sun, 24 Apr 2016 at 06:18 omar notifications@github.com wrote:
|
Thinking out loud here..
This topic is made confusing partly because collapsing triangles are using With default settings: So things appears to lines up perfectly. And BulletText() also uses Where this becomes a problem is when you want to want to introduce a concept of "leaf", because there's different ways to define what a leaf may be. In most of examples provided by @Cthutu and @kylawl you are showing one-liner label leaves, which are equivalent to calling BulletText(), and no other items. In this situation it doesn't matter that (A) and (B) may have different values. (A) == 21, (B) == 22 (A) == 21, (B) == 14, no problem. However, once you want to go not one-liner, and add extra content in the leaf item, (A) and (B) being different cause a problem. It's not a big problem, but the fact that
Solution could involve a mix of some of those tasks:
Ideally that would have been easier from day 1 if tree label where displayed at the current cursor X position and the arrow was displayed to the left of that (which is what the proposal flag would do) - going to experiment with that and consider side-effects. |
AFAIK your initial request should be full-fillled. You can use either:
|
When you're building a tree view it's nice to be able to keep all items at the same level aligned as well as hide the arrow on items which have no children.
Currently we're swapping between text items and borderless collapsibles and just putting 3 spaces before the text items which keeps everything roughly aligned but it that's really a fluke.
The text was updated successfully, but these errors were encountered: