Skip to content

ImGui::ListBox is rendering other listboxes inside of each other #3526

@Bizzie2k

Description

@Bizzie2k

Version: 1.78 WIP

Back-ends: imgui_impl_dx9.h + imgui_impl_win32.h
Compiler: Visual Studio 2019, using v142 build tools. (if the question is related to building or platform specific features)
Operating System: Windows 10

Issue: When trying to render a listbox from another listbox (i.e. if the user selects one option on a listbox, render another listbox below it), the new listbox will become a part of the old one, however any features under the listbox will fit as though the listbox had its own area.

Without selecting any options (normal):
Capture
With selecting an option to attempt to render a new listbox (abnormal):
Capture1

static int selectedItemArray = 0;
static const char* items[]{ "Please select one:", "Primary", "Secondary", "Knives" };
static int PrimarySelected = 0;
static const char* PrimaryItems[]{ "Please select one:",
                                        "This would be a big array nobody would want to see" };

ImGui::ListBox("", &selectedItemArray, items, IM_ARRAYSIZE(items));
        switch (selectedItemArray) {
        case 0:
            break;
        case 1:
            ImGui::ListBox("", &PrimarySelected, PrimaryItems, IM_ARRAYSIZE(PrimaryItems));
            break;
        }

Used to work fine and the way it was intended, but apparently I messed something up by adding a float slider under it (which I removed, still wont render as intended) and now it gives me this issue. Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions