Limiting ImGui::InputInt to a range

I am trying to limit ImGui::InputInt to a range, e.g. let’s say values between 1 and 100.
When this function returns I can check if the new value is in the range and if not just force it.
However, the user can double click into the field ImGui::InputInt and type any number, e.g. 8000.
I can’t check if(ImGui::InputInt) and limit the value as it always returns true while the user is editing, so I have to remove the manual check, but then when it loses focus the out-of-range value is still there.
I don’t want to turn off the ability for the user to enter a value manually, but I’d still like to be able to limit it to a specific range.
Any ideas how I could achieve that?
Thanks.

I can’t check if(ImGui::InputInt) and limit the value as it always returns true while the user is editing, so I have to remove the manual check,

I don’t understand what you can’t have this checking/clamping when the widget returns true. That’s the point of this return events. The edited text won’t appear modified until the user validate with Enter/Tab.

Sorry, Omar, you are correct; I can check every time a character is added; that’s no problem.
My actual issue is that whenever the field is edited my code will talk to hardware and I’d like to only tell the hardware to do something once the editing is done.
So for example, when the user wants to enter a value of 5678 my current code will send 5, then 56, then 567 and then 5678 to the hardware, but I’d like to only send the value 5678 to the hardware.
Is there a way to check if the input field is still being edited? I guess there is ImGuiInputTextFlags_EnterReturnsTrue, but does that also return true when the user doesn’t not press enter and just clicks outside the input box?

You can use functions such as IsItemDeactivatedAfterEdit().
See Demo->Widgets->Querying Status to see the other functions.