Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID and name problem #4070

Closed
warm-dawn opened this issue Apr 25, 2021 · 4 comments
Closed

ID and name problem #4070

warm-dawn opened this issue Apr 25, 2021 · 4 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@warm-dawn
Copy link

I encountered such a problem:
There are many ImGui::Checkboxes with the same name, but for some reason, I can't rely on ImGui::PushID to solve this problem.
Is there any other solution?

@jimgbuck
Copy link

Can you post code as to why the id won't work? With the text you pass to Checkbox, you can tag the text with "your checkbox text##some unique id per checkbox".. if you use "###", it will only use the text after the "###" as the id, but it otherwise uses the whole string as the id.. but the important point is that none of the text starting with the "##" or "###" will print on-screen. It's just used for id purposes only.

@warm-dawn
Copy link
Author

解决了:ImGui::PushID(&flag);
直接以地址作为id, 哈哈

@warm-dawn
Copy link
Author

@jimgbuck thanks a lot!

@jimgbuck
Copy link

Hah, no problem, yeah, using a pointer can sometimes work, but I hope that flag persists per-checkbox. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
label/id and id stack implicit identifiers, pushid(), id stack
Projects
None yet
Development

No branches or pull requests

3 participants