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

Multiple checkboxes with no label don't get click event #3375

Closed
nobody-special666 opened this issue Aug 2, 2020 · 3 comments
Closed

Multiple checkboxes with no label don't get click event #3375

nobody-special666 opened this issue Aug 2, 2020 · 3 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@nobody-special666
Copy link

Branch: latest docking + tables merged
Back-ends: imgui_impl_allegro5.cpp
Operating System: ubuntu 20.04 Linux

See code sample.
Hovering works fine, but if you click on the checkbox in the 2nd column of the table,
instead it expands the 1st column's width. Adding a label seems to fix the bug as work-around.
Cheers

void
show_bug()
{
    ImGui::SetNextWindowSize(ImVec2(400, 200), ImGuiCond_Always);

    bool window_visible = true;
    if (ImGui::Begin("MyWindow", &window_visible))
    {

        static ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersHOuter | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg;

        if (ImGui::BeginTable("##Table", 2, flags))
        {
            ImGui::TableNextRow();

            ImGui::LabelText("", "checkbox");

            ImGui::TableNextCell();

            static bool mybool=0;
            ImGui::Checkbox("", &mybool);
            // ImGui::Checkbox(" ", &mybool);   // FIX: adding a label fixes the bug
            ImGui::TableNextRow();

            ImGui::EndTable();
        }

        ImGui::End();
    }
}

@ocornut ocornut added the label/id and id stack implicit identifiers, pushid(), id stack label Aug 2, 2020
@ocornut
Copy link
Owner

ocornut commented Aug 2, 2020

@ocornut ocornut closed this as completed Aug 2, 2020
@ocornut ocornut changed the title Tables: BUG: checkbox (with no label) against column boundary doesn't get click event Multiple checkboxes with no label don't get click event Aug 2, 2020
@nobody-special666
Copy link
Author

Apologies for wasting your time.
Thank you for quick reply.

@ocornut
Copy link
Owner

ocornut commented Aug 2, 2020

No worries. It is such common issue this is why FAQ exist :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
label/id and id stack implicit identifiers, pushid(), id stack
Projects
None yet
Development

No branches or pull requests

2 participants