MultiSelect: Fixed CTRL+A not testing focus scope id. Fixed CTRL+A not testing active id. Added demo code.

Comments.
This commit is contained in:
omar
2020-03-20 12:34:52 +01:00
committed by ocornut
parent 7abda179af
commit 9aeebd24f7
2 changed files with 38 additions and 11 deletions

View File

@@ -7153,9 +7153,11 @@ ImGuiMultiSelectData* ImGui::BeginMultiSelect(ImGuiMultiSelectFlags flags, void*
}
// Select All helper shortcut
// Note: we are comparing FocusScope so we don't need to be testing for IsWindowFocused()
if (!(flags & ImGuiMultiSelectFlags_NoMultiSelect) && !(flags & ImGuiMultiSelectFlags_NoSelectAll))
if (IsWindowFocused() && g.IO.KeyCtrl && IsKeyPressed(GetKeyIndex(ImGuiKey_A)))
ms->In.RequestSelectAll = true;
if (ms->FocusScopeId == g.NavFocusScopeId && g.ActiveId == 0)
if (g.IO.KeyCtrl && IsKeyPressed(GetKeyIndex(ImGuiKey_A)))
ms->In.RequestSelectAll = true;
#ifdef IMGUI_DEBUG_MULTISELECT
if (ms->In.RequestClear) printf("[%05d] BeginMultiSelect: RequestClear\n", g.FrameCount);