Skip to content
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

Numpad Enter key is ignored when using ImGuiInputTextFlags_EnterReturnsTrue #2191

Closed
dcourtois opened this issue Nov 15, 2018 · 5 comments
Closed

Comments

@dcourtois
Copy link

Configuration:

  • docking branch @ 5f8c9ae (but probably valid for all branches)
  • GLFW / OpenGL3 back-end (unmodified)
  • Windows 10 / Visual Studio 2017 (up-to-date)
  • Compiled in Debug / Win64

To explain the issue a bit further: when using an input with the ImGuiInputTextFlags_EnterReturnsTrue option flag, only the Enter key of the main part of the keyboard is actually working. Validating the input using the numpad Enter key doesn't work.

The problem comes from here:

else if (IsKeyPressedMap(ImGuiKey_Enter))

This only checks for one key value; however GLFW has 2 distinct values for those 2 Enter keys, thus only one of my keyboard's Enter keys is working.

If most implementations support 2 different values for those 2 enter keys, it might make sense to add a new value into the ImGuiKey_ enum to handle this secondary Enter key ? If you have any idea as to how this should be handled (if it should) feel free to comment here, I can work on a fix and send a pull request for review :)

@ocornut ocornut added the inputs label Nov 15, 2018
@ocornut
Copy link
Owner

ocornut commented Nov 15, 2018

This is the PR you are looking for #2005:
In the meanwhile you can hijack ImGui_ImplGlfw_KeyCallback() function to replace GLFW_KEY_KP_ENTER with GLFW_KEY_ENTER.

@dcourtois
Copy link
Author

@ocornut thanks for the quick answer ! I only checked the issues, next time I'll think of checking the PR too :) And thanks for the ImGui_ImplGlfw_KeyCallback pointer, it works perfectly. Closing this issue, sorry for the inconvenience.

@ocornut
Copy link
Owner

ocornut commented Nov 16, 2018 via email

@ocornut
Copy link
Owner

ocornut commented Jul 22, 2019

Note that this is now fixed by #2625.

@timbeaudet
Copy link

timbeaudet commented Oct 11, 2024

Umm, with this being fixed, is the TL;DR of how I'm supposed to a NumpadEnter to the KeyMap when ImGuiKey_Return or _NumpadEnter don't exist?

Finally found it for anyone else: ImGuiKey_KeypadEnter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants