KeyPress::numberPadAdd, is this a bug?

I have a simple KeyListener class listening from a Component using Component::addKeyListener(). When I use any sign of my PC num pad, the Keypress.keyCode generated is 43 instaed 65643. What’s wrong?

1 Like

Is NumLock active on your keyboard?

With numLock enabled or disabled I have the same result hitting the + key. I tried in another laptop, and again the same. keyCode is always 43 instead 65643. However, [keypad] numbers work ok.

Could somebody confirm if this is a bug? Jules?

Hate to bump such old topics, but I’m having the exact same problem still on Windows 10. The actual ‘+’ key on my numpad gives a KeyPress int of 43. Checking against KeyPress::numberPadAdd doesn’t work.

2 Likes

I also have this problem on Windows 10.

It seems that the value 43 is given by this line :

const UINT keyChar  = MapVirtualKey ((UINT) key, 2);

In the function doKeyDown() at juce_gui_basics\native\juce_win32_Windowing.cpp

It seems that the numpad keys can directly give the value instead of the corresponding KeyPress::numberPad[something].

For example : when I use a KeyMappingEditorComponent and add a shortcut for a command with the ‘+’ key of my numpad, I get only “+” instead of “numpad +”.