-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Description
Version/Branch of Dear ImGui:
Version ImGui v1.89.5 (release)
Back-ends:
custom engine
Compiler, OS:
Windows 10, VS 2022, CLang for compile Android library
Full config/build information:
Details:
When two ImageButton (in turn), the second button does not respond to click:
Hello. I ran into the problem that when I use two buttons with image, the second one does not click, and accordingly (if you look at the example) the message was not displayed. I was finding a solution from this topic (#2464), but before that I thought that it should automatically generate an ID inside itself, as ImGui::Button does.
I understand that the generation of the ID in ImGui::Button depends on the 'label' and specifying the ID and so on. However, could it have been done differently for ImageButton to solve the problem? And how reliable is the use of ImGui::PushID(11) in this case, will there be any failures or bugs?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
// Here's some code anyone can copy and paste to reproduce my issue
ImGui::Begin("ImageButton ID Bug");
if (ImGui::ImageButton(arrow, ImVec2(110, 110)))
{
Log("button up clicked");
}
if (ImGui::ImageButton(arrow, ImVec2(110, 110), ImVec2(1,1), ImVec2(0,0)))
{
Log("button down clicked");
}
ImGui::End();
// This solution helped me fix the problem:
ImGui::Begin("ImageButton ID Maybe fix");
if (ImGui::ImageButton(arrow, ImVec2(110, 110)))
{
Log("button up clicked");
}
ImGui::PushID(11);
if (ImGui::ImageButton(arrow, ImVec2(110, 110), ImVec2(1,1), ImVec2(0,0)))
{
Log("button down clicked");
}
ImGui::PopID();
ImGui::End();