No numpad recognition on Mac?

3 posts / 0 new
Last post
chkn
Offline
Last seen: 5 days 3 hours ago
Joined: 8 Mar 2007 - 17:17
No numpad recognition on Mac?

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());"

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);

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

jules
Online
Last seen: 14 min 20 sec ago
Joined: 29 Apr 2013 - 18:37
Re: No numpad recognition on Mac?

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

chkn
Offline
Last seen: 5 days 3 hours ago
Joined: 8 Mar 2007 - 17:17
Re: No numpad recognition on Mac?

Thanks, now it works!