Imgui: OuterRect of Tables overlap what is placed on his right (cause issue for move scrollbar)

Created on 9 Jan 2021  路  2Comments  路  Source: ocornut/imgui

Current/Master:

Version: Current
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl.cpp
Compiler: MSVC
Operating System: Win 10 x64

My Issue/Question:

I have an issue in my app when i use table with another widgets on the right side.
the scrollbar is difficult to manipulate due to overlaped widgets :

Screenshots/Video

9JHmkMVdlz

Standalone, minimal, complete and verifiable example:

{
            ImGui::Begin("Table issue");
            static ImGuiTableFlags flags = ImGuiTableFlags_SizingPolicyFixed | ImGuiTableFlags_RowBg |
                ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoHostExtendY;
            if (ImGui::BeginTable("##fileTable", 3, flags, ImVec2(300,0)))
            {
                ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible
                ImGui::TableSetupColumn("aaaa", ImGuiTableColumnFlags_WidthStretch, -1, 0);
                ImGui::TableSetupColumn("bbbb", ImGuiTableColumnFlags_WidthAuto, -1, 1);
                ImGui::TableSetupColumn("cccc", ImGuiTableColumnFlags_WidthAuto, -1, 2);
                ImGui::TableHeadersRow();
                ImGui:ImGuiListClipper clipper;
                clipper.Begin(20, ImGui::GetTextLineHeightWithSpacing());
                while (clipper.Step())
                {
                    for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
                    {
                        if (i < 0) continue;

                        ImGui::TableNextRow();
                        if (ImGui::TableSetColumnIndex(0)) ImGui::Text("AAAA");
                        if (ImGui::TableSetColumnIndex(1)) ImGui::Text("BBBB");
                        if (ImGui::TableSetColumnIndex(2)) ImGui::Text("CCCC");
                    }
                }
                clipper.End();
                ImGui::EndTable();
            }

            ImGui::SameLine();

            ImGui::BeginChild("##FileTypes");
            static float sliderValue = 0.0;
            for (int i = 0; i < 20; i++)
                ImGui::SliderFloat("slider", &sliderValue, 0, 100);
            ImGui::EndChild();

            ImGui::End();
        }

the result with the repo. see whith scrollbar the OuterRect are overlaped's

jt7CX5SNWg

bug layout tablecolumns

Most helpful comment

Thank you. That鈥檚 definitely a bug with how scrolling tables declare their outer size to the layout system. Should be an easy fix.

All 2 comments

Thank you. That鈥檚 definitely a bug with how scrolling tables declare their outer size to the layout system. Should be an easy fix.

Fixed by not overwriting outer_window->DC.CursorPosPrevLine.x when using a child window (was previously checking ScrollX only). I made some other tweaks and comments to that code which ultimately should be moved to the layout system.

Thank you for the report.!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bizehao picture bizehao  路  3Comments

KaungZawHtet picture KaungZawHtet  路  3Comments

GrammarLord picture GrammarLord  路  3Comments

BlackWatersInc picture BlackWatersInc  路  3Comments

Folling picture Folling  路  3Comments