-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added ImGuiInputTextFlags_TabReturnsTrue for commit and navigate behavior for Input widgets #2215
Conversation
Is your real use case that you are setting both Have you checked the following functions: What do you want to happen if the user CLICKS on another widget with a value has been typed in but no validated? |
Yes,
If the user clicks out of the input box, the value that was there is discarded and reverted to previous. In general, the "commit" behavior is desired over "on changed" so the value is applied once. It is understandable that some widgets want to "discard and revert" on tab instead.
But in our usage, tab to commit is nice for editing lots of fields. |
I think this is what |
Sorry missed those questions. EDIT: thinking about it from the user perspective, if the user clicks off the widget whilst editing, it should not be committed as neither enter or tab "commited" the value. I believe in this case discard and retain the old value would make sense. |
I am not sure understand this last post or the sample. You are not testing the return value of
|
Yes. What I mean is that there should be a generic way to handle that and it should be
Based on your example you should only need to do:
Or maybe even:
EDIT Let me dig into this a little more.. because maybe there is a bug with IsItemDeactivatedAfterEdit and tabbing. |
I confirm there is a bug with Tab handling of InputText() and the IsDeactivatedXXX flags. |
Regression Test (If you are curious... ) Don't mind the syntax too much, I am still experimenting with the automation framework and each new test bring their own challenge in term of keeping this elegant.
|
…text instead of window. Storing new data will allow us to fix the bug mentioned in #2215 (probably in next commit).
Hello @zzzyap, And sorry again to be hijacking the PR for what initially was a request to add the TabReturnsTrue flag, but we're heading toward a solution. I have now pushed the fixes that made In fact, prior to the fix if you were to run the app at very low framerate (e.g. 3 FPS, which I frequently do in order to catch flickering and shearing issues) you would notice that when tabbing forward with the Tab keys, both previous and current fields would draw as active for the frame. This is now fixed as well. With those fixes in, my understanding is that you should not need the When you have time, let me know if that's the case or if you feel there is still a use for |
Good! Which user action do you expect to trigger the "discard" path? |
Mouse click, since that triggers the deactivated after edit. |
I assume you are trying to maintain some habit formed by legacy code? |
Yup its non-standard, but that's something for me to convince them otherwise. |
Various refactor done in 2018 and the recent one should make #701 a little easier to do now (even if ideally we should completely remove the U16 buffer). |
Related to this, I'm not too sure if this is a bug or not. After reverting this pr from our local fork (which is based on this commit b1af4d3) and testing it with other input widgets, I noticed the following. Example: calling the following (Expected) Value set on enter. (Not expected) Value discarded on tab. |
@zzzyap The post above is a little confusing, could you narrow down a repro?
is likely wrong, Tab is processed on the frame after the press (otherwise we can't handle Shift+Tab). |
followed by
|
I think your problem is that
Please confirm this is the root of your issue and we can open another issue for it. Testing |
Yes. As for the tab (testing in the example sln), I believe it is correctly signaled, it's within the frame that it is set from the wndproc. (using win32) |
Some of the
My bad. You are right, the deactivation itself is process within the frame. However the activation of the next/prev widget may happen on the next frame. |
Usage Context:
Notes: