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

Unresponsive controls on repeated elements with same label #96

Closed
jristic opened this issue Dec 8, 2014 · 3 comments
Closed

Unresponsive controls on repeated elements with same label #96

jristic opened this issue Dec 8, 2014 · 3 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@jristic
Copy link

jristic commented Dec 8, 2014

I'm having trouble with the following bit of code:

for (int& digit : digits) {
    ImGui::InputInt("int", &digit);
}

The elements following the first don't seem to work correctly (won't increase/decrease unless the button is held) if they are given the same label. Are the labels supposed to be unique?

@jristic jristic changed the title Unresponsive controls on repeated elements Unresponsive controls on repeated elements with same label Dec 8, 2014
@Flix01
Copy link

Flix01 commented Dec 8, 2014

Please see if: #74 solves your issue.

@ocornut
Copy link
Owner

ocornut commented Dec 8, 2014

The ID are inferred from label.
In this case you can do, e.g.

for (int& digit : digits) {
    ImGui::PushID(digit);
    ImGui::InputInt("int", &digit);
    ImGui::PopID();
}

You probably want to use some form of PushID call for every loop of repeated elements/blocks.

@jristic
Copy link
Author

jristic commented Dec 8, 2014

Makes sense, thanks!

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