Skip to content
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 add widgets to the left of a Tree or CollapsingHeader #6294

Closed
thewoz opened this issue Apr 2, 2023 · 3 comments
Closed

How to add widgets to the left of a Tree or CollapsingHeader #6294

thewoz opened this issue Apr 2, 2023 · 3 comments
Labels
tree tree nodes

Comments

@thewoz
Copy link

thewoz commented Apr 2, 2023

Hello everyone,
sorry to bother again.
I am trying to figure out how to implement something like this.

test

Where the eye and the checkmark are buttons.

I tried to read the following posts #282 #460 #2920 and couldn't quite figure out how to do it.
Basically I would like to use a CollapsingHeader but if it was possible to do it just with tree that would be fine too.

@ocornut
Copy link
Owner

ocornut commented Apr 3, 2023

Also see #600

You would need to pass the ImGuiTreeNodeFlags_AllowOverlapMode flag to your CollapsingHeader() or TreeNode().
Then use SameLine() or SetCursorScreenPos() to position yourself to the desired button location and submit the button.

@ocornut ocornut added the tree tree nodes label Apr 3, 2023
@thewoz
Copy link
Author

thewoz commented Apr 3, 2023

hi Omar,
thank you for your reply!
sorry i didn't see #600
I think ImGuiTreeNodeFlags_AllowOverlapMode became ImGuiTreeNodeFlags_AllowItemOverlap.
Using ImGuiTreeNodeFlags_AllowItemOverlap and SameLine() everything works! Thanks!

Also saw #846 do you think it will become official sooner or later?

@ocornut
Copy link
Owner

ocornut commented Apr 3, 2023

I think ImGuiTreeNodeFlags_AllowOverlapMode became ImGuiTreeNodeFlags_AllowItemOverlap.

Correct.

Using ImGuiTreeNodeFlags_AllowItemOverlap and SameLine() everything works! Thanks!

Good to hear, closing.

I have no eta for anything, but the aim is to make enough change to our layout system to make that PR possible as an extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tree tree nodes
Projects
None yet
Development

No branches or pull requests

2 participants