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

Synchronized table resize border doesn't register mouse input when height are differents #3955

Closed
sinisastevanovic opened this issue Mar 21, 2021 · 5 comments

Comments

@sinisastevanovic
Copy link

sinisastevanovic commented Mar 21, 2021

Version/Branch of Dear ImGui:

Version: 1.83 WIP
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Operating System: Win10

My Issue:

When creating two or more Tables with the same ID (so the column width is synced) and TreeNodes as content,
the line where you resize the columns doesn't register mouse input correctly when TreeNodes are expanded only in one of the tables.

Is this intended? If so, how can I sync the column width without sharing the ID?

Screenshots/Video

Screenshot 2021-03-21 152447

Sample Code
`

    ImGui::Begin("Test1");
    for (int j = 0; j < 2; j++)
    {
        ImGui::Separator();
        static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_RowBg;
        float minRowHeight = 30.0f;
        if (ImGui::BeginTable("table_test", 2, flags))
        {
            ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthStretch, 0.5f);
            ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthStretch, 0.5f);
            for (int i = 0; i < 5; i++)
            {
                ImGui::TableNextRow(0, minRowHeight);
                ImGui::TableSetColumnIndex(0);
                std::string propName = "Hello " + std::to_string(i);

                if (ImGui::TreeNodeEx(propName.c_str(), ImGuiTreeNodeFlags_SpanFullWidth, propName.c_str()))
                {
                    for (int h = 0; h < 5; h++)
                    {
                        ImGui::TableNextRow(0, minRowHeight);
                        ImGui::TableSetColumnIndex(0);
                        ImGui::Text("\t\tChild");
                        ImGui::TableSetColumnIndex(1);
                        ImGui::Text("ChildValue");
                    }

                    ImGui::TreePop();
                }
            }
            ImGui::EndTable();
        }
    }

    ImGui::End();`
@ocornut
Copy link
Owner

ocornut commented Mar 22, 2021

As requested by the issue template, an actual minimal repro would be helpful here.
I'm not entirely sure the problem is precisely the one you stated and only a repro can express the issue accurately.

@sinisastevanovic
Copy link
Author

sinisastevanovic commented Mar 23, 2021

@ocornut Sure, I'm sorry! I've added sample code for now.

@ocornut ocornut added the bug label Mar 24, 2021
@ocornut ocornut changed the title Table resize border doesn't register mouse input correctly with expanded TreeNodes and shared Table IDs Synchronized table resize border doesn't register mouse input when height are differents Mar 24, 2021
@ocornut
Copy link
Owner

ocornut commented Mar 24, 2021

Thanks a lot! I could confirm there is a bug with synchronized tables. This was puzzling at first, and then I realized it had nothing to do with TreeNode or actual contents, but is caused by the fact the tables have different height. We are store a "last table height" and this gets overwritten by each tables using the same ID of a synchronized set.

Coincidentally this was mentioned a few days ago there:
#3565 (comment)

Will investigate a fix for it!

ocornut added a commit that referenced this issue Mar 1, 2022
…e of several synchronized instance of a same table ID, when instances have a different height. (#3955, #3565)
@ocornut
Copy link
Owner

ocornut commented Mar 1, 2022

Managed to fix this issue today (fix is 0f14933). Closing, thanks for reporting!

@ocornut ocornut closed this as completed Mar 1, 2022
@sinisastevanovic
Copy link
Author

Thanks a lot! You're a legend :)

sergeyn pushed a commit to sergeyn/imgui that referenced this issue Mar 19, 2022
…e of several synchronized instance of a same table ID, when instances have a different height. (ocornut#3955, ocornut#3565)
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