Skip to content

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

@nobody-special666

Description

@nobody-special666

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();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions