faithkeron.blogg.se

Macintosh key codes
Macintosh key codes






macintosh key codes
  1. MACINTOSH KEY CODES HOW TO
  2. MACINTOSH KEY CODES PORTABLE
  3. MACINTOSH KEY CODES CODE

So, for example, you will never see ‘space’ unless you have killed that default shortcut for the Selection Tool. That could be a gotcha if for example a shifted key has a different character on it than the US standard.Īlso, and this is very important to know, keys and key combinations that are set as shortcuts are processed by SketchUp before they reach your Tool’s onKeyDown. I don’t know what Apple does for international Macs or what happens if you attach a non-English keyboard as I have neither to test. In your examples, option + = gives ≠ which codes to 0x2260 as you saw (and is what I pressed to get that symbol in this post!). For example shift + ‘=’ gives ‘+’ (code 0x2b), as indicated on the keyboard. The modifier keys produce extended characters. In your examples, 0x3d is the basic Latin Unicode for ‘=’, 0x2d for ‘-’. Also, your onKeyDown will receive two callbacks, one for the modifier and another for the modified character. Rather, the Unicode value for the as-modified character is returned. I was incorrect (must be what happens in some other callback?): modifier keys don’t OR bits into the code. The value of key on Mac is the Unicode representation of the character. I have to run now so I can’t investigate further at the moment, but maybe later today.Įdit: I’m back with more info.

MACINTOSH KEY CODES CODE

I’m pretty sure that the codes for modified keys are created by bitwise OR of a modifier key code with the base key code.

MACINTOSH KEY CODES PORTABLE

Codes for other keys are, as you have seen, not portable and in the specific case of VK_EQUAL and VK_MINUS are not even defined on Mac SketchUp. As noted in the topic you linked, there is a limited list of OS-independent constants in the method’s documentation.

macintosh key codes

I don’t know of any official reference on how the SketchUp Ruby API generates the key codes it passes to onKeyDown. Should I be bit twiddling? Should I be subtracting/adding a certain integer from them similar to this? Is it safe to assume that the key codes I got with modifier keys down are unique even with the modifier keys up? Also, is this changing of key codes normal behavior on OSX, or is this a SketchUp thing, or is it normal everywhere and I’ve only encountered it now?

MACINTOSH KEY CODES HOW TO

I don’t really how to properly handle this. What confused me even more is that when I was holding down modifier keys while I pressed them, the codes were different: option + equal = 0x2260 The key codes that I got were: equal = 0x3d # expected 0x18 I’m aware that keyboard layout may affect this, but this post seems to imply that it doesn’t (but maybe those keys in particular don’t change?). Most of the lists of OSX key codes I’ve found online (including the ones linked to from here) list VK_EQUAL and VK_MINUS as 0x18 and 0x1b respectively. After testing on a MacBook Air and a MacBook Pro, it seems I’ve been checking for the wrong key codes (for VK_MINUS and VK_EQUAL in particular) on OSX. I’ve written a tool utilizing onKeyDown(key, repeat, flags, view) which works fine on Windows, but not on OSX.








Macintosh key codes