Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change ImGui Button name when click it

Tags:

imgui

Is it possible to change the button name when you click it?

I'm currently doing a imgui project. I want to change the Global view and the Local view in one button using ImGui::Button. Is that possible in the current ImGui version right now?

like image 674
Shawn_wicky Avatar asked Nov 28 '25 04:11

Shawn_wicky


1 Answers

Just change the label of the button depending on your current state.. And you can use the ### operator (described in FAQ) to keep a stable ID.

if (ImGui::Button(view_is_local ? "Local###ViewMode" : "Global###ViewMode"))
    view_is_local = !view_is_local;
like image 72
Omar Avatar answered Nov 30 '25 00:11

Omar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!