Scroll lock key detection

I’m trying to detect the scroll lock key being pressed as an event, has anyone managed to do this in Xojo?

You’ll need to use a timer and query Keyboard.AsyncKeyDown.

On Windows, you’ll need a declare, since AsyncKeyDown only detects when the user is currently pressing the key (not when it was already pressed and the LED is on).
This one should work:

Declare function GetKeyState lib "User32" (nVirtKey as Integer) as Integer
Var ScrollLockState As Boolean=GetKeyState(145)=1
1 Like

Or do it with hooks and a few declares Low-Level Keyboard Hook in C# | Microsoft Learn

don’t know C#

will try on timer