Login Page - Create Account

Support Board


Date/Time: Sun, 08 Sep 2024 02:09:10 +0000



[User Discussion] - Is There A Way To Detect Whether Caps Lock Is On Or Off?

View Count: 509

[2023-01-31 20:59:26]
Tony - Posts: 502
It's probably a long shot, not sure if it can be done either from Sierra Settings or ACSIL?

Thanks in advance.
[2023-01-31 22:27:06]
ondafringe - Posts: 273
You can in ACSIL.

Convert the Windows Key Code for Caps Lock in hex (0x14) to decimal (20).

if (sc.SetDefaults)
{

//Other Code

sc.ReceiveKeyboardKeyEvents = true;

return;
}

int pressedKey = sc.KeyboardKeyEventCode;

if (pressedKey == 20)
{
//Do Something
}

pressedKey = 0;


You might be able to check for the hex value directly, but this was so easy, I never tried to work the hex-check out.

Windows Key Codes
https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Convert Hex-to-Decimal
https://www.rapidtables.com/convert/number/hex-to-decimal.html
Date Time Of Last Edit: 2023-01-31 22:42:30
[2023-02-01 02:09:22]
Tony - Posts: 502
Hi ondafringe,

Thanks so much for your reply!

Unfortunately, I am not able to use sc.KeyboardKeyEventCode after version 2439 (sc.CharacterEventCode works fine), most likely it was my Linux+Wine issue, I haven't figured out why ever since. Also, I am hoping to have a sign telling me the current on/off state of Caps Lock.

Thanks all the same.

cheers,

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account