No numpad recognition on Mac?


#1

issue #1

Windows: When i press “1” on the left side I get Description “1”, on the numpad i get "numpad 1"
Mac: Always get “1”

bool Editor::keyPressed (const KeyPress& key1, Component* originatingComponent) { DBG("Desc "+key1.getTextDescription());

issue #2
…another issue, i have a workaround, but im wondering if its normal.

result of KeyPress::createFromDescription(“W”).getKeyCode() is different from when i’m pressing “W” on the keyboard in the keyPressed() callback procedure and call key.getKeyCode();

As a workaround i use “KeyPress newkey=KeyPress::createFromDescription(key.getTextDescription());”

[code]bool Editor::keyPressed (const KeyPress& key, Component* originatingComponent)
{
String keyDescription1=“W”;
int keyCode1=KeyPress::createFromDescription(keyDescription1).getKeyCode();

int keyCode2=key.getKeyCode();
String keyDescription2=KeyPress(keyCode2).getTextDescription();

DBG("keyCode1 ="+String(keyCode1)+"  keyDescription1="+keyDescription1);
DBG("keyCode2 ="+String(keyCode2)+"  keyDescription2="+keyDescription2);

[/code]

Im Pressing the Key “w” on PC:

keyCode1 =87 keyDescription1=W keyCode2 =87 keyDescription2=W

on Mac:

keyCode1 =87 keyDescription1=W keyCode2 =119 keyDescription2=W

( i know that keyCode differs on different platforms, but a least createFromDescription should be non-ambiguous?)

PS: i’m using a PC-keyboard on my Mac, don’t know if its relevant, maybe someone can cross-check


#2

Thanks, I’ve ironed those things out now - try the tip and see if it helps.


#3

Thanks, now it works!