-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Can't change underlying number value when InputText has focus #2881
Comments
Hello,
I don't know what your input scheme is for that widget, but one possible work-around is to set the |
I was using that, but it was a bit weird since I had to set that value before, but I was changing the value after since I need to check hover state, etc. I just tried locally adding a new ImGuiInputTextFlags_Dynamic to re-initialize the control if it changes, but floating point precision is making it a bit unstable. I think I'll just have to add a something to ImGuiInputTextState to force it to reset in a nice way. In my case it's for a custom control so that makes sense. I'm not sure if this is a feature we would want to be publicly facing anyway. |
I think it would be good to first add that feature as an imgui_internal.h api (calling a function or poking into the state structure), when we redesign |
This seems to do the job: Unfortunately I'm not in a good state to make a pr for it. |
…seful in custom controls if the value gets modified while the text input control is in focus. ocornut#2881
…seful in custom controls if the value gets modified while the text input control is in focus. ocornut#2881
I have a related use case. I'm writing a file dialog and am using EDIT: I made this work using the callback interface, though it was a bit convoluted. |
Version: ~1.72b (a116439)
Branch: Docking
Back-ends: imgui_impl_win32.cpp + imgui_impl_dx12.cpp
Operating System: win10
My Issue/Question:
While trying to implement custom interaction with number fields I hit an issue where I need to clear the focus of the control to change the underlying value. To easily repro the issue:
Causes:
Example of controls I was trying to setup:
https://gist.github.com/kudaba/01337c088a0bcef0c2e22a4e846f729c
The text was updated successfully, but these errors were encountered: