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

Multi-column layout isn't aware of scroll bar #893

Closed
mkeeter opened this issue Nov 1, 2016 · 3 comments
Closed

Multi-column layout isn't aware of scroll bar #893

mkeeter opened this issue Nov 1, 2016 · 3 comments

Comments

@mkeeter
Copy link
Contributor

mkeeter commented Nov 1, 2016

Normally, things that are told to fill their window (with a size of -1.0f) adjust based on whether the scroll bar is displayed or not.

This doesn't work when drawing more than one column:
resize
Notice that the full-width buttons change size, but the first multi-column buttons do not.

Here's a minimal reproduction:

    ImGui::SetNextWindowSize({300, 100}, ImGuiSetCond_Once);
    ImGui::Begin("Demo");
    ImGui::Columns(2);
    ImGui::Button("dear", {100, 0});
    ImGui::NextColumn();
    ImGui::Button("imgui", {-1, 0});
    ImGui::Columns(1);
    ImGui::Button("hello world", {-1, 0});
    ImGui::Button("goodbye world", {-1, 0});
    ImGui::Button("hello there", {-1, 0});
    ImGui::End();

I'd be glad to dig into this myself if you can give me a few pointers for where to look!

@ocornut
Copy link
Owner

ocornut commented Nov 1, 2016

I forgot the exact reason now, but it was intentional as it made lots of problems easier to solve. Last time I looked into it (1+ year ago) came to the conclusion it was better not fixing.

I may dig back into it at some point, ideally we'd fix it. It is causing you a specific problem or it is just a thing you noticed?

@mkeeter
Copy link
Contributor Author

mkeeter commented Nov 2, 2016

It's not particularly critical, but I did run into this while doing real work:
I'm doing a layout that uses both columns and ImGui::SameLine, and noticed the discrepancy in where the right edge lines up.

screen shot 2016-11-01 at 8 46 57 pm

I fixed it by shrinking the SameLine layout by ImGui::GetStyle().ScrollbarSize, which is inelegant but makes the edges line up nicely.

ocornut added a commit that referenced this issue Aug 20, 2017
…ar. Not 100% sure about that but it looks like we've fixed enough bugs that this may not cause troubles anymore. (#125, #913, #893, #1138)
@ocornut
Copy link
Owner

ocornut commented Aug 20, 2017

This should be fixed now. @mkeeter. As you are using Columns, would be interested in seeing if you are seeing any issue with the latest update.

@ocornut ocornut closed this as completed Aug 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants