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

SameLine issue/bug #1330

Closed
darkgnostic opened this issue Sep 20, 2017 · 6 comments
Closed

SameLine issue/bug #1330

darkgnostic opened this issue Sep 20, 2017 · 6 comments

Comments

@darkgnostic
Copy link

If I have SameLine right after CollapsingHeader like:

if (ImGui::CollapsingHeader("Header", ImGuiTreeNodeFlags_DefaultOpen )) {
    ImGui::SameLine();if(ImGui::Button(UID(k,"Select"))) {}
}

I will have button inside the header, on which I cannot click.

I don't know if this is intended behavior or not (possibility to place buttons inside the collapsing header).

@ocornut
Copy link
Owner

ocornut commented Sep 20, 2017 via email

@darkgnostic
Copy link
Author

It's not about expectation, that's a fact. I accidentally invoked behavior I reported.

Button IS rendered inside the header. I just asked if buttons placement like that is intended or not.

If it is not intended, then it is bug.

If it is intended, then again it is bug, as I can't click on button.

@darkgnostic
Copy link
Author

darkgnostic commented Sep 20, 2017

Example

@ocornut
Copy link
Owner

ocornut commented Sep 20, 2017

If it is not intended, then it is bug.
If it is intended, then again it is bug, as I can't click on button.

It's actually sort of intended and mimic the layout behavior of TreeNode().
When items are overlapping by default the first item receives the focus. You may call SetItemAllowOverlap() after CollapsingHeader() to allow the upcoming button to overlap so you can use this sort of pattern.

SetItemAllowOverlap isn't a default properly because it adds a latency of one-frame on detecting Hovering of a given widget, but I expect to expose this as a global flag for people who'd codebase who's prefer this behavior.

PS: Please use Github attachment system and not imgur for attachment, as they will delete them, making those threads less useful for future readers.

@darkgnostic
Copy link
Author

Ok, if there is no needed change in the code, please close this issue.

@ocornut
Copy link
Owner

ocornut commented Sep 20, 2017

Cool,
I took note in the TODO list that auto-allow-overlap should be exposed as part of the upcoming flag stack.
You can also pass ImGuiTreeNodeFlags_AllowOverlapMode directly to the CollapsingHeader function.

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

No branches or pull requests

2 participants