Interesting that my users should become aware of this now when its been this way for years at least and maybe forever But it turns out that calls to the async version of checking for keyboard modifiers does not work when your keyboard is connected via screensharing. They are always false even if youre holding the key down. They work find with a real connected keyboard, and its not a new bug as I tested my little test app as far back as xojo 2013 and its still false. The non-async versions of the call work fine screen sharing or not.
Since this has been that way forever is it still a bug? Or just something that needs to be documented as a gotcha?
I would suppose indeed that a keyboard that is not attached to the computer would not work with the Keyboard class, which taps directly into the hardware.
Does not look like a bug to me.
I get that And am thinking that its more something that should be noted in the documentation…
In my experience, a documentation feature request is usually implemented same day by Paul Lefebvre.
It’s probably a downside of the fact that Screen Sharing is based on the VNC protocol, which does not support this, I believe. Or it’s because the OS X API that Xojo’s framework uses does not support this - I faintly remember that the “what keys are currently pressed down” map is managed at a lower level (i.e. at the kbd driver level) than the keydown/keyup events. And this map is what AsyncKey… uses.
Ideally, OSX should maintain it this way: It channels all key down/up events from all connected keyboards thru a “pressed keys” map that will get updated accordingly. And there then should be an API that apps can use to query that map. And remote control software such as VNC would then automatically work with the key map as well because VNC sends the same key events thru the same channels. But that’s not the case, sadly.
So, this is a design bug in the OS, and Xojo can’t do anything about it, I’m afraid.
Disclaimer: This is based on my over-15 year-old knowlege. Maybe something has improved in the OS in the mean time.