-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Tables: cannot calc content width properly #3568
Comments
Hello,
Can you confirm which git commit hash are you on? Thank you!
|
It seems git history has been rewritten on branch/Tables, |
I'm trying to reproduce this issue with the following code, BUT it seems like that this issue is not introduced by branch/tables: 1.79 WIP (17803) was manually merged from master@4fd43a8 + branch/tables, AND it works as expected: each columns' width is fitting its content. BUT on current branch of tables, columns' width is only determinate by it's column's name if the content is DragFloat static ImGuiTableFlags flags = ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable;
static float shared_value = 0.6180339887;
static char *columns[] = {"col1", "col2", "col3", "col4", "col5", "col6", "col7", "col8", "col9", "col10", "col11"};
ImGui::SetNextWindowSize(ImVec2(400, 200), ImGuiCond_FirstUseEver);
if (ImGui::Begin("IssuseTable"))
{
if (ImGui::BeginTable("##issue3568", 11, flags))
{
for (int i = 0; i < 11; ++i)
{
ImGui::TableSetupColumn(columns[i], ImGuiTableColumnFlags_WidthFixed);
}
ImGui::TableHeadersRow();
for (int i = 0; i < 3; ++i)
{
ImGui::TableNextRow();
for (int j = 0; j < 11; ++j)
{
if (ImGui::TableNextColumn())
{
if (j % 2 == 0)
{
ImGui::AlignTextToFramePadding();
ImGui::Text("text value %d", j);
}
else
{
ImGui::SetNextItemWidth(-FLT_MIN);
ImGui::DragFloat("##dagfloat", &shared_value, 1, 0, 0, "%.4f");
}
}
}
}
ImGui::EndTable();
}
}
ImGui::End(); |
Thank you for the repro. I think you misunderstood the fact that:
This will make the widget use available space. And therefore always request exactly the width the of column. |
Thank you, I think it's the result of the change on minimum width of columns, I'm submitting the width explicitly using |
For this to happens we'd need to rework some fundamental of our layout system and ItemAdd etc func. I think eventually we will do that but in the short-term. I'll post again here if it ends up being implemented someday. (we need to have multiple variations of "CursorMaxPos" essentially, the issue in #3414 also requires a similar thing to be done to distinguish "requested width" from "scrollable width"). |
Version/Branch of Dear ImGui:
Version: 1.80 WIP (17905)
Branch: tables
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp +imgui_impl_opengl3.cpp
Operating System: MacOS
My Issue/Question:
In recent update tables cannot figure out the right width of columns when using slider of dragfloat as cell's content.
But it works as expected in 1.79 WIP (17803)
Screenshots/Video
1.80 WIP (17905)
1.79 WIP (17803)
The text was updated successfully, but these errors were encountered: