Closed
Description
Version/Branch of Dear ImGui:
Version 1.90.6, Branch: master
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler, OS:
Windows 10 + gcc
Full config/build information:
No response
Details:
My Issue/Question:
I want to create a multi select combo box that doesn't close when selecting an option. I am currently using the example from #1658 and it closes when I selected and option. Is there a way to keep the popup open when clicking the selectable inside of it?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO", "PPPP", "QQQQQQQQQQ", "RRR", "SSSS" };
static const char* current_item = NULL;
if (ImGui::BeginCombo("##combo", current_item)) {
for (int n = 0; n < IM_ARRAYSIZE(items); n++) {
bool is_selected = (current_item == items[n]);
if (ImGui::Selectable(items[n], is_selected)
current_item = items[n];
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
Found solution
Use ImGuiSelectableFlags_DontClosePopups on selectables.
Metadata
Assignees
Labels
No labels
Activity