-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
InputFloat3 can't accept changes when ImGui::IsItemDeactivatedAfterEdit() #8065
Comments
I'm currently noticing odd behavior with I am not entirely sure that However, may I ask why you need |
Also |
But pressing enter will always deactivate either way.
_EnterReturnsTrue essentially breaks editing for those specific widgets. So its only natural that other signals would be broken. |
Simply because I don't know all the ins and outs of the back end of ImGui perfectly. This was a solution that was doing as I desired, whether it was all necessary or not. I think I started with |
So:
|
( SetItemDefaultFocus() and SetKeyboardFocusHere() are amount of last remnant of some old API i will rework and improve. I agree they can be confusing. I am not even sure it is possible to use |
To be clear my usage of SetItemDefaultFocus() was intended to clear item focus, not necessarily got back to previous item. Perhaps I was still using it wrong.
I modified the code to the following (for both this and my InputText version) and it seems to behave exactly as I was trying to get working. Including on enter as you said; as far as my needs go this is a good solution!
|
Thanks for confirming. I will investigate the remaining bug now. |
…rReturnsTrue is not supported by InputFloat, InputInt etc. (#8065) It was never correctly supported. Please open an issue if you this would be useful to you. Otherwise use IsItemDeactivatedAfterEdit().
I've looked into that and established that I tried to make it work, which led me to do a little bit of refactor of some systems 38617a5 used by If someone comes up with a need for it the asserts tells them to open an issue. Standalone test-bed: {
const bool PressedEnter = ImGui::InputFloat("float1", &clear_color.x, 1.0f, 1.0f, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::Text("PressedEnter: %s / DeactivatedAfterEdit: %s", PressedEnter ? "XXXX" : "____", ImGui::IsItemDeactivatedAfterEdit() ? "XXXX" : "____");
}
{
const bool PressedEnter = ImGui::InputFloat3("float3", &clear_color.x, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::Text("PressedEnter: %s / DeactivatedAfterEdit: %s", PressedEnter ? "XXXX" : "____", ImGui::IsItemDeactivatedAfterEdit() ? "XXXX" : "____");
} |
Version/Branch of Dear ImGui:
1.89.9
Back-ends:
imgui_impl_XXX.cpp + imgui_impl_XXX.cpp
Compiler, OS:
Windows 10, MSVC 2022
Full config/build information:
Details:
I can't get InputFloat3 to accept the value on Enter and loss of focus like I can with InputText. As far as I can tell,
ImGui::IsItemDeactivatedAfterEdit()
isn't working with InputFloat3(), or at least not when combined withImGuiInputTextFlags_EnterReturnsTrue
I want InputFloat to behave by accepting the change on Enter (ImGuiInputTextFlags_EnterReturnsTrue) with a combination of keeping them when IsItemDeactivatedAfterEdit() to keep values when tabbing or clicking to another control. The following code-block works perfectly for InputText:
However that doesn't work with the InputFloat3, my suspicion is this stems from there being 3 InputBoxes in the float3? Is there a way to get that same behavior, I think it might even help the value drift issue from #3936, but I have created a new ticket because they may be unrelated, no values are drifting in this instance for me. The following code allows the value to change on enter, but does not change the value if I change the focus to anything else, including tabbing from X to Y (internally with the Float3), or Z to another control (externally).
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: