-
-
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
Redundant scrollbar with BeginChild inside a table #6619
Comments
Hello, ImGui::BeginChild("foo", ImVec2(0.0f, -ImGui::GetStyle().CellPadding.y)); (It's only temporary as once fixed you would not need it as it would add unnecessary padding) |
I pushed a fix for a tangential issue 2bc5d17 (+ test ocornut/imgui_test_engine@03da9cd) I need to fix before yours, but this is not the fix you need yet. |
…lower cell padding or of using ImGuiTableFlags_NoHostExtendY. (#6619) Made GetContentRegionMax() fully defer to WorkRect when inside a table container.
I pushed a fix db66e33. If you cherry-pick both 2bc5d17 and db66e33 it'll merge in docking branch. Not done with the tests, but for reference here's my test bed if (ImGui::Begin("Test #6619"))
{
static ImGuiTableFlags table_flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Borders;
static ImVec2 table_size = ImVec2(0.0f, 0.0f);
ImVec2 sz1 = ImGui::GetContentRegionAvail();
ImVec2 sz2;
ImGui::ColorButton("##blah1", { 1,1,0,0.5f }, 0, { 50,300 });
ImGui::SameLine();
if (ImGui::BeginTable("Table", 2, table_flags, table_size))
{
ImGui::TableNextRow();
ImGui::TableNextColumn();
sz2 = ImGui::GetContentRegionAvail();
if (0)
{
ImGui::Button("Fill", ImVec2(-FLT_MIN, -FLT_MIN));
}
else
{
ImGui::PushStyleColor(ImGuiCol_ChildBg, { 0,1,0,0.5f });
ImGui::BeginChild("foo");// , ImVec2(0.0f, -ImGui::GetStyle().CellPadding.y * 2.0f));
ImVec2 child_size = ImGui::GetWindowSize();
ImGui::Text("\n\n\nChild %.2f, %.2f", child_size.x, child_size.y);
ImGui::EndChild();
ImGui::PopStyleColor();
}
ImGui::TableNextColumn();
ImGui::ColorButton("##blah1", { 1,0,1,0.5f }, 0, { 50,250 });
ImGui::EndTable();
}
ImGui::Begin("test4");
ImGui::Text("Avail %f %f", sz1.x, sz1.y);
ImGui::Text("Avail %f %f", sz2.x, sz2.y);
ImGui::CheckboxFlags("NoHostExtendY", &table_flags, ImGuiTableFlags_NoHostExtendY);
ImGui::CheckboxFlags("ScrollY", &table_flags, ImGuiTableFlags_ScrollY);
ImGui::InputFloat2("TableSize", &table_size.x);
ImGui::End();
}
ImGui::End(); |
Closing this as solved. |
Thank you, it does fix my issue. |
Version/Branch of Dear ImGui:
Version: 07d1709 (the latest)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_dx9.cpp + imgui_impl_win32.cpp, but also custom backend
Compiler: VS2022
Operating System: Win10
My Issue/Question:
I'm trying to use table API instead of old columns API to create layout like in the attached screenshot, but there is unnecessary scrollbar, caused by child window inside table. It works fine when using columns API.
Screenshots/Video
Standalone, minimal, complete and verifiable example:
The text was updated successfully, but these errors were encountered: