ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
59.7k stars 10.17k forks source link

combobox in the TabItem has an error #6364

Closed ashe27 closed 1 year ago

ashe27 commented 1 year ago

The first parameter of BeginCombo cannot be left blank, otherwise it will not pop up correctly under the TabItem. I'm not sure if this is a bug.

if (ImGui::BeginTabItem("Test"))
{
    if (ImGui::BeginCombo("", "None"))
    {
        ImGui::EndCombo();
    }
    ImGui::EndTabItem();
}
cfillion commented 1 year ago

It needs a non-empty label to compute the combo box's unique ID. The label can be hidden by prepending ## to it: ImGui::BeginCombo("##my_combo", ...).

https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-about-the-id-stack-system

ashe27 commented 1 year ago

It needs a non-empty label to compute the combo box's unique ID. The label can be hidden by prepending ## to it: ImGui::BeginCombo("##my_combo", ...).

https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-about-the-id-stack-system

thanks