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

InputText() old inputs change simultaneously with new user inputs #5383

Closed
svkvarun43 opened this issue Jun 9, 2022 · 3 comments
Closed

Comments

@svkvarun43
Copy link

svkvarun43 commented Jun 9, 2022

Version/Branch of Dear ImGui:

Version: 1.88
Branch: master

My Issue/Question:

I am getting three user input through ImGui::InputTextWithHint() , The inputs get display on screen,

But when i edit the user input the previous input displayed on the screen also changes :(

Screenshots/Video
My text input window, which gets input from user

When I redit my user input, the text change simultaneously in the display area too, How can I avoid this happening?

I am looking to display the new user input than retaining/rediting the previous entered input

Snippet which gets the user input:

Any help would be appreciated

@ocornut
Copy link
Owner

ocornut commented Jun 9, 2022

Use two sets of variables..
You are currently unhappy that a variable you give to InputText() is edited, that its purpose. If you use a single set of variable there's no concept of "previous input" and "new user input" here.

@ocornut
Copy link
Owner

ocornut commented Jun 10, 2022

Use two sets of variables..
You are currently unhappy that a variable you give to InputText() is edited, that its purpose. If you use a single set of variable there's no concept of "previous input" and "new user input" here.

Closing as answered but feel free to comment if you are unsure how to proceed.

@ocornut ocornut closed this as completed Jun 10, 2022
@svkvarun43
Copy link
Author

svkvarun43 commented Jun 12, 2022

True, I am a bit stuck on how to proceed unfortunately, could you help me please. Maybe a small example how to avoid the simultaneous change please. @ocornut

For ref,
My goal was to get user inputs into the textinput and print them on screen on clicking "OK"

Once it has been passed and display, the field should be cleared for getting new user textinput.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants