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

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

Closed
Bizzie2k opened this issue Oct 13, 2020 · 2 comments
Closed

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

Bizzie2k opened this issue Oct 13, 2020 · 2 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@Bizzie2k
Copy link

Bizzie2k commented Oct 13, 2020

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.

@Bizzie2k
Copy link
Author

The issue fix: I needed to add names to the other list boxes.

@ocornut
Copy link
Owner

ocornut commented Oct 13, 2020

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