Is it possible to have two Buttons with the same Button Text using the "dear imgui"?
Because generating two or more ImGui::Button("PRESS") will lead to the situation that only the first is reacting on selection (tested on GCC / Win64 / MinGW)
Yes.
The reason only the first of two ImGui::Button("Press") objects will register is because - by default - ImGui uses the button's text as its identifier.
You can circumvent this by either using PushID() and PopID() around your buttons to create a new ID stack, or by adding additional information to your button by adding "##" after the button text.
E.g.: ImGui::Button("Press##1") and ImGui::Button("Press##2") will both register while both only having "Press" on the button.
All text after "##" will only be used to set that button's identifier and won't be displayed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With