How to disable right mouse button selection in the MultiSelect?
Opened this issue · 5 comments
Version/Branch of Dear ImGui:
Version 1.XX, Branch: XXX (master/docking/etc.)
Back-ends:
imgui_impl_XXX.cpp + imgui_impl_XXX.cpp
Compiler, OS:
Linux
Full config/build information:
No response
Details:
My Issue/Question:
As I understand, by default, right mouse button clicks generate ImGuiSelectionRequests. How do I prevent this? I only want to select with LMB.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
Always selecting on right-click isn't directly configurable (you can use ImGuiMultiSelectFlags_NoAutoSelect but that has other side-effects you probably don't want.)
My understanding from Omar's comment here is that it's done intentionally so that items get selected when you open their context menu (which is consistent with how other user interfaces behave.)
It'd be helpful to know why you want to disable the functionality.
@PathogenDavid thank you for the answer.
I wanted to reset selection with right click, just like Escape key does. I am making a level editor for the game, there is a list of entities, you select them to perform some actions and then you want to deselect them. Pretty much only way to deselect is pressing Ecs. But I thought it would be nice to deselect with RMB, some editors/games do this and I always liked it.
Your explanation makes sense, I understand now why RMB selects by default. This is not critical issue for me, so I will either try to find workaround to have this, or just accept and move on.
I see no harm adding a flag to disable this, and I would comment on the general-purpose default behavior too.
Added ImGuiMultiSelectFlags_NoSelectOnRightClick in 63bfad4. Let me know if that works for you.
Wow, thank you, nice!