3 questions about RemoteControlMBS


I’m using the RemoteControlMBS and having these 3 questions:

1: what’s the difference between PressShiftKey vs the three platform-specific variants (MacPressShiftKey, WinPressShiftKey and LinuxPressShiftKey)? Does PressShiftKey just replace all three (since e.g. WinPressShiftKey wouldn’t do anything on Mac, anyway)?
(same question applies for other similar keys)

2: say I have a character as input (e.g. “@”). I need to figure out which keys would produce this character, like alt+g on my Swiss-french Mac OS layout. For Windows, this looks like a good choice: WinVirtualKeyForASCII, although I haven’t tried yet.

For Mac, the closest function I found is this one: MacTextForKeyCode. But I have to loop through all keys (0 to 127) with all combination of dead keys until I find the correct one (would be time consuming for a string, for example). Isn’t there a direct way?

And, for Linux, I have no great idea. I found LinuxKeyNameToKeySymbol, but I can’t figure out whether the alt/control/shift keys should be pressed or not given the result of the call. I am missing something?

And what if the current keyboard layout just can’t produce the character I have as input?

3: when using MacMousePositionX (and similar functions about the location of the mouse), I’m getting an exception. Its message tells me “Not yet implemented”. That’s not a big problem, as I can use System.MouseX, but I don’t remember having seen this before. Has this been rewritten?

I recognise it makes a lot of questions, and I’m sorry about that, but I feel I’ve come across limitations that I’d not have expected.
Thanks in advance.


1 Like

PressShiftKey calls MacPressShiftKey, WinPressShiftKey and LinuxPressShiftKey internally depending on the platform.

In one project here we used MacTextForKeyCode, looped over all values and build a lookup table to know the codes.

For Linux you can google for keysymdef.h or e.g. read here:

Sorry, but MacMousePositionX was not implemented for macOS 64-bit, only 32-bit long ago.

1 Like

Ah, thanks.
So the individual Mac, Win and Linux versions are not useful.

Good idea. I’ll add a method for that, called when the app launches and when I detect a layout change.

Thank you very much for your help.

We had the per platform functions before.

1 Like

Makes sense. Thanks.