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
Accepting input on text field losing 'focus'. #700
I'm trying to solve a problem with input text fields. Currently they only return true when enter is pressed (due to ImGuiInputTextFlags_EnterReturnsTrue flag), but I also want it to return true when TAB is pressed to go to next input field, or if the mouse is clicked elsewhere.
A good example of where this is useful is in InputInt3 where pressing TAB is quite natural for people to accept an entry for the first int and move to the next int.
Any advice or is it just not possible with the current implementations?
It doesn't behave the same way as Windows or Mac. When tabbing to the next field or click outside the input field, the user doesn't expect their previous input to be reset. The only time it is reset in these OS's is by pressing ESC.
For example, open notepad and go to the 'Save As...' dialog box. Enter a filename and press TAB. The filename you enter doesn't disappear.
It's not a showstopper, but I do try to aim for the Principle of Least Surprise when it comes to UIs.
Err, the value should never be reset in ImGui unless you press Esc. If that this the case then it is a bug and that should be fixed instead of adding a new flag.
It doesn't behave the same way as Windows or Mac. When tabbing to the next field or click outside the input field, the user doesn't expect their previous input to be reset. The only time it is reset in these OS's is by pressing ESC.
For example, open notepad and go to the 'Save As...' dialog box. Enter a filename and press TAB. The filename you enter doesn't disappear.
It's not a showstopper, but I do try to aim for the Principle of Least Surprise when it comes to UIs.
―
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
Err, the value should never be reset in ImGui unless you press Esc. If
that this the case then it is a bug and that should be fixed instead of
adding a new flag.
It doesn't behave the same way as Windows or Mac. When tabbing to the
next field or click outside the input field, the user doesn't expect their
previous input to be reset. The only time it is reset in these OS's is by
pressing ESC.
For example, open notepad and go to the 'Save As...' dialog box. Enter a
filename and press TAB. The filename you enter doesn't disappear.
It's not a showstopper, but I do try to aim for the Principle of Least
Surprise when it comes to UIs.
―
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
OK, the demo doesn't use the EnterReturnsTrue flag, which is why it works. For example, I change the code in the demo to be:
if (ImGui::InputFloat3("input float3", vec4a, -1, ImGuiInputTextFlags_EnterReturnsTrue))
{
ImGui::LogText("Changed");
}
When you press TAB now, it resets. Without the flag I get it returning true everytime I type a key which is not what I want. I am forced to use the EnterReturnsTrue flag.
Isn't that the point of that flag? What problem are you trying to solve? ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified)
That flag is the only way to return true once when the input is done with. Currently knowing when the input is done with is when you press 'enter', which is all well and good. However, on modern operating systems, they decide when you've finish editing by 'enter', 'tab' or clicking elsewhere. So, I am guess I am saying I really want this flag:
Granted, then we'd need a new flag and to rework InputText accordingly.
Though I am wondering if you are having issue with immediate update and what sort of issues? (I myself sometimes wanted non-immediate update)
Setting the xyz values of an object is something you don't live update on,
otherwise the object will be jumping about as you type :)
On Thu, Jun 16, 2016 at 16:14, omar notifications@github.com wrote:
Activity
ocornut commentedon Jun 16, 2016
Hi,
Isn't just the default behavior aka returning true whenever changed, enough?
Cthutu commentedon Jun 16, 2016
It doesn't behave the same way as Windows or Mac. When tabbing to the next field or click outside the input field, the user doesn't expect their previous input to be reset. The only time it is reset in these OS's is by pressing ESC.
For example, open notepad and go to the 'Save As...' dialog box. Enter a filename and press TAB. The filename you enter doesn't disappear.
It's not a showstopper, but I do try to aim for the Principle of Least Surprise when it comes to UIs.
ocornut commentedon Jun 16, 2016
Err, the value should never be reset in ImGui unless you press Esc. If that this the case then it is a bug and that should be fixed instead of adding a new flag.
Cthutu commentedon Jun 16, 2016
Interesting: in the demo, input float3 works when tab is pressed. Let me
look at this more closely.
On Thu, 16 Jun 2016 at 15:50 omar notifications@github.com wrote:
Cthutu commentedon Jun 16, 2016
OK, the demo doesn't use the EnterReturnsTrue flag, which is why it works. For example, I change the code in the demo to be:
When you press TAB now, it resets. Without the flag I get it returning true everytime I type a key which is not what I want. I am forced to use the EnterReturnsTrue flag.
ocornut commentedon Jun 16, 2016
Isn't that the point of that flag? What problem are you trying to solve?
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified)Cthutu commentedon Jun 16, 2016
That flag is the only way to return true once when the input is done with. Currently knowing when the input is done with is when you press 'enter', which is all well and good. However, on modern operating systems, they decide when you've finish editing by 'enter', 'tab' or clicking elsewhere. So, I am guess I am saying I really want this flag:
:)
Of course, a ImGuiInputTextFlags_InputDoneReturnsTrue would be more sensible a name!
Is it clear what I am getting at?
ocornut commentedon Jun 16, 2016
Granted, then we'd need a new flag and to rework InputText accordingly.
Though I am wondering if you are having issue with immediate update and what sort of issues? (I myself sometimes wanted non-immediate update)
Cthutu commentedon Jun 16, 2016
Setting the xyz values of an object is something you don't live update on,
otherwise the object will be jumping about as you type :)
On Thu, Jun 16, 2016 at 16:14, omar notifications@github.com wrote:
Added ImGuiItemFlags_LiveEdit flag, and much-awaited support for disa…
Split ImGuiItemFlags_LiveEdit into ImGuiItemFlags_LiveEditText, ImGui…