Skip to content

Child window with no border seems to be ignoring WindowPadding #462

@dsusini

Description

@dsusini

I've created a "tool panel" style child window that is aligned with the left of the parent window. When I set it's border to 'false', all window padding seems to be ignored. I tried setting the default padding to something large like 20. When BeginChild is called with border=true, the padding shows like usual. When I pass false, the padding is ignored. I'm not sure if this is intended or not. I made a simple example to test this out:

(We have to make sure the childBG has a valid color)

ImGui::SetNextWindowSize(ImVec2(1200, 700), ImGuiSetCond_FirstUseEver);
ImGui::Begin("edit_window", NULL);
    ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 8));
    ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, ImVec4(0.16f, 0.16f, 0.16f, 1.00f));
    ImVec2 toolbarSize(300, 0);
    ImGui::BeginChild("toolbar", toolbarSize, false);
        ImGui::Text("Testing");
        ImGui::Spacing();
        ImGui::Text("Testing2");
    ImGui::EndChild();
    ImGui::PopStyleColor();
    ImGui::PopStyleVar();
ImGui::End();

Please let me know if this is something I'm doing wrong, working as intended, or if it's a bug. I can easily work around it for now, but it's just one of those annoying things :)

Thanks!
Don

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions