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

How button works in columns #2885

Closed
seukaiwokeo opened this issue Nov 7, 2019 · 3 comments
Closed

How button works in columns #2885

seukaiwokeo opened this issue Nov 7, 2019 · 3 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@seukaiwokeo
Copy link

`ImGui::Columns(6, NULL, false);
for (int i = 0; i < Items.size(); ++i) {
if (ImGui::Button("Get")) {
SetItem(Items[i]);
}

}

ImGui::Columns(1);`

First button in columns works but the others doesn't

@ocornut ocornut closed this as completed Nov 7, 2019
@TheoMcIntosh
Copy link

`ImGui::Columns(6, NULL, false); for (int i = 0; i < Items.size(); ++i) { if (ImGui::Button("Get")) { SetItem(Items[i]); }

}

ImGui::Columns(1);`

First button in columns works but the others doesn't

I have the same issue :( did you solve it?

@ocornut
Copy link
Owner

ocornut commented Jan 15, 2023

i have the same issue :( did you solve it?

I already answered with the solution.
Read the FAQ https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-about-the-id-stack-system
You should use PushID()/PopID() in loops generally to make underlying identifiers uniques.

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