To be more precise, I have an InputText which up until recently worked perfectly.
I wanted to move the labels to the left side and found another issue here where the solution given was to use:
ImGui::Text(label); ImGui::SameLine();
ImGui::InputText(#hidden label....)
I assumed hidden meant empty string, since null does not work.
But then the InputText did not behave properly when keys were pressed. Did not update the visibe string,nor did it return a changed==true.
Followed the debugger and edit_state.TempTextBuffer and buf_display get changed to the new string as well as the local value_changed flag, but somewhere along the road , the value of the boolean changes to false.
Forgot to mention that at this point, I have the same wrapper code around two Input fields, one is an InputInt and the other an InputText. InputInt with an empty label("") works ok. InputText doesn't.
When I change the label from "" to " ", it works.
Please read the FAQ How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on labels/IDs.
in imgui.cpp.
You need unique ID, which you can obtain by using e.g. ##label
.
Right. I used Push/Pop ID elsewhere but didn't think to look to how the ID thing works. I had the same conflict over buttons in the same scope with the same label. I also used it wrong. Thought it was about setting the id for the next control, not that it creates a scope whose name takes part in the hash of the scoped controls.
Anyway thanks for the help and sorry for the unnecessary issue.
Most helpful comment
Please read the FAQ
How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on labels/IDs.
in imgui.cpp.You need unique ID, which you can obtain by using e.g.
##label
.