You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need InputScalar() return true on ImGuiInputTextFlags_EnterReturnsTrue when typing, and return true when stepping #9299
Currently the InputScalar() function suggests to use IsItemDeactivatedAfterEdit() , this is cumbersome but does work, however I also have step amounts, adding the "+" and "-" buttons, and these do not trigger.
I can work around this somehow, but it's now reaching the point where I wish the InputScalar() function honored the ImGuiInputTextFlags_EnterReturnsTrue flag.
For instance, the code is used for many different types in our generic config, and some of these don't work with sliders or change-on-edit inputs (like editing the global UI DPI scale... editing this can cause a lot of visual jarring)
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
// implies plain input// inputScalar does not support change on enter, so we use IsItemDeactivatedAfterEdit()auto tempFlags = flags; // remove the change on enter flagif ((tempFlags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
{
tempFlags = static_cast<ImGuiInputTextFlags_>(tempFlags & ~ImGuiInputTextFlags_EnterReturnsTrue);
tempFlags = static_cast<ImGuiInputTextFlags_>(tempFlags | ImGuiInputTextFlags_LocalizeDecimalPoint);
}
ImGui::InputScalar("##val", ImGuiDataType_Float, &editing_float, &step, &step_fast, "%.3f", tempFlags);
if (hasValidRange)
{
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Allowed range: %g - %g", min_value, max_value);
}
editing_float = std::clamp(editing_float, min_value, max_value);
}
if (!isPlainInput || !isChangeOnEnter || ImGui::IsItemDeactivatedAfterEdit())
{
*value->get() = editing_float;
}
While I understand there is a separate desire for ImGuiInputTextFlags_EnterReturnsTrue support to be figured out.
I cannot seem to repro this part:
IsItemDeactivatedAfterEdit() , this is cumbersome but does work, however I also have step amounts, adding the "+" and "-" buttons, and these do not trigger.
[00226] ret 1, deac 0 // clicked on +
[00232] ret 0, deac 1 // release mouse
Because the step button are repeating and on Down, the modification doesn't necessarily happen on the same frame as the deactivation. Which is discussed at #8149.
changed the title [-]Need InputScalar() return true on ImGuiInputTextFlags_EnterReturnsTrue when typeing, and return true when stepping[/-][+]Need InputScalar() return true on ImGuiInputTextFlags_EnterReturnsTrue when typing, and return true when stepping[/+]on Apr 2, 2026
The specific issue with +/- not working if you are not holding on backing data is tracked at #8149.
Other than that:
I have reinstated ImGuiInputTextFlags_EnterReturnsTrue for InputInt, InputFloat, InputScalar etc.
(final commit is the simple 10c378c but it depends on various other changes done previously).
And fixed various aspects of it:
Fixed the fact that it didn't return true when validating same value.
Fixed losing underlying value when tabbing out or losing focus.
Made it that pressing +/- step buttons also return true, which is in line with 1.91.4 behavior.
Note:
You will not get a signal in the return value when tabbing out or losing focus.
So you should probably still use IsItemDeactivatedAfterEdit() in most cases.
Reminder, IMHO all of this is a workaround for the fact that we don't have a way to request value write-back to backing-data on validation only, and most people are trying to work around this. THIS SHOULD BE COMING SOON.
Please open a new Issue if you have an issue with ImGuiInputTextFlags_EnterReturnsTrue.
AFAIK, the remaining issue with IsItemDeactivatedAfterEdit() is: if intentionally NOT holding on backing data (aka always passing a temporary): the +/- buttons won't work because the IsItemDeactivatedAfterEdit() arrives one frame after writing-back. (#8149) If you think there is another issue with IsItemDeactivatedAfterEdit() please post a new issue 🙏
Activity
ocornut commentedon Mar 13, 2026
Linking to #8665 #3946 #6284
ocornut commentedon Mar 13, 2026
While I understand there is a separate desire for
ImGuiInputTextFlags_EnterReturnsTruesupport to be figured out.I cannot seem to repro this part:
Because the step button are repeating and on Down, the modification doesn't necessarily happen on the same frame as the deactivation. Which is discussed at #8149.
[-]Need InputScalar() return true on ImGuiInputTextFlags_EnterReturnsTrue when typeing, and return true when stepping[/-][+]Need InputScalar() return true on ImGuiInputTextFlags_EnterReturnsTrue when typing, and return true when stepping[/+]Internals: store ImGuiItemStatusFlags_EditedInternal bypassing ImGuiI…
InputInt, InputFloat, InputScalar: reinstated and fixed ImGuiInputTex…
ocornut commentedon Apr 24, 2026
The specific issue with +/- not working if you are not holding on backing data is tracked at #8149.
Other than that:
I have reinstated
ImGuiInputTextFlags_EnterReturnsTruefor InputInt, InputFloat, InputScalar etc.(final commit is the simple 10c378c but it depends on various other changes done previously).
And fixed various aspects of it:
Note:
IsItemDeactivatedAfterEdit()in most cases.Please open a new Issue if you have an issue with
ImGuiInputTextFlags_EnterReturnsTrue.AFAIK, the remaining issue with
IsItemDeactivatedAfterEdit()is: if intentionally NOT holding on backing data (aka always passing a temporary): the +/- buttons won't work because theIsItemDeactivatedAfterEdit()arrives one frame after writing-back. (#8149) If you think there is another issue withIsItemDeactivatedAfterEdit()please post a new issue 🙏Added ImGuiItemFlags_LiveEdit flag, and much-awaited support for disa…
Split ImGuiItemFlags_LiveEdit into ImGuiItemFlags_LiveEditText, ImGui…