Skip to content

Tables: unexpected column's ItemWidth when using PushItemWidth/PopItemWidth or multi-components widgets #3760

@dmlo

Description

@dmlo

Version/Branch of Dear ImGui:

Version: 1.80 via Conan, 1.81 WIP via git clone just now
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: Clang 11.0.1
Operating System: Arch Linux

My Issue/Question:

Experienced unexpected draw result with ImGui::DragFloatRange2() while testing the new (very nice) Tables API.

In the upper part of the left window is the new tables implementation. The lower part is the same content using the previous Columns API.

The smaller window on the right is the MCVE code below.

Issue occurs using any of the three table layout methods described in imgui_demo.cpp beginning at line 3477.

Screenshots/Video

image

Standalone, minimal, complete and verifiable example:

    ImGui::Begin("Drag");
    if(ImGui::BeginTable("Table1", 2)){
        std::vector<float> vals1{0.5, 1.5, 2.5};
        std::vector<float> vals2{1.5, 2.5, 3.5};

        for (int i = 0; i <3; i++) {
            ImGui::TableNextRow();

            ImGui::TableSetColumnIndex(0);
            ImGui::Text("Row %d", i);

            ImGui::TableSetColumnIndex(1);
            ImGui::DragFloatRange2("label", &vals1[i], &vals2[i]);
        }
        ImGui::EndTable();
    }
    ImGui::End();

Thank you for this excellent UI library. It is a pleasure to use.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions