-
-
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
Custom Escape key handling in Input functions #5688
Comments
I am currently working on a larger feature which will allow this. |
While I'm working on a generic system for routing and owning keys and shortcut, I also realize the behavior your mention is fairly common, so I also added it as a dedicated flag: It clears inputs if not empty otherwise deactivate the widget. |
Hey that solves my use case, thanks a lot! |
Version/Branch of Dear ImGui:
Version: v1.88
Branch: master
My Issue/Question:
In any input widget, pressing the escape key currently has a hard-wired behavior: It removes the last-added portion of the text. It's debatable if that behavior is correct - other programs usually delete the entire input. However the greater problem is that this behavior can neither be changed nor disabled. It's not altered by
ImGuiWindowFlags_NoNavInputs
for example, but rather fixed behavior in imgui_widgets.cpp.This makes it impracticable to use the escape key for more advanced logic. For example I was planning to delete the current selected input if it's not empty, and go back to a menu window otherwise. But this collides with imgui's own logic that clears an input field - but only if it's the first input - a nightmare to reverse-engineer and couteract.
I would welcome any way to mitigate this - could be hiding this behind a flag or whatever.
The text was updated successfully, but these errors were encountered: