-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
SliderInt & Combo without label text interaction issue #2475
Description
Version/Branch of Dear ImGui:
Version: 1.69
Branch: MASTER
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler: VS2017
Operating System: Windows 10
My Issue/Question:
When you have a SliderInt above a Combo, without text in the label fields of both, when interacting with the combo, it will interact with the slider instead. If you however have a label propagated on either, the issue does not persist.
Is this behavior a bug, or is this expected? I do not wish to have text next to either the slider or combo in my project so it would be nice if I don't need it.
Screenshots/Video
Here's an example without the text, creating the issue.

Here's another example but with text that eliminates the issue.

Standalone, minimal, complete and verifiable example:
{
ImGui::Begin("Test Window");
static int int0= 0;
ImGui::PushItemWidth(200);
ImGui::SliderInt("", &int0, 0, 6);
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD" };
static int item_current = 0;
ImGui::Combo("", &item_current, items, IM_ARRAYSIZE(items));
ImGui::End();
}
This one with text propagating the combo to eliminate the issue.
{
ImGui::Begin("Test Window");
static int int0= 0;
ImGui::PushItemWidth(200);
ImGui::SliderInt("", &int0, 0, 6);
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD" };
static int item_current = 0;
ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items));
ImGui::End();
}