CommandKeyDown whichKey - how do I easily reference keypad numbers on Mac

Bob Sneidar bobs at twft.com
Mon Jan 16 19:28:55 EST 2012


I have found that key handling can be iffy for keys not part of the normal characters. For instance, someone was having issues with the arrowKey message. It only seems to be generated with one or two of the arrow keys. People in your situation end up using rawKeyDown and figuring out what those key ID's are. 

Bob


On Jan 16, 2012, at 3:17 PM, Alan Gayne wrote:

> Greetings listMates,
> 
> I've got a series of similar keyboard shortcuts that are called by a "commandKeyDown whichKey" combination, where "whichKey" is intended to be a number.
> 
> on commandKeyDown whichKey
> 	switch whichKey
> 		case "1"
> 			(do stuff)
> 		break
> 		case "2"
> 			(do other stuff)
> 		break
> 		
> 		(and so forth)
> 	end switch
> end commandKeyDown
> 
> No issue at all when "whichKey" is one of the numbers at the top of the QUERTY keyboard, but when I try to use the commandKeyDown number combination using the numbers on the extended keyboard keypad it didn't work.
> 
> So I checked which key was being returned for each of these keys, and got "65436" for keypad number 1, "65433" for keypad number 2, etc.
> 
> Now I can certainly script responses for each of the strange (to me) whichKey parameters coming off the keypad, but it would be a bit of a kludge, and it seems to me that there must be an easy way to make these keys return the numbers printed on each key, and which are typed every time I press one of these keys.
> 
> I'm on a 2011 iMac with extended keyboard running Snow Leopard 10.6.8 but I'd also like these shortcuts to work properly on a Windows desktop keyboard.
> 
> Anybody know the trick to making this work easy?  
> 
> Thanks in advance for your help in this matter. 
> 
> Kind regards,
> Alan Gayne
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list