Detecting CAPS LOCK

Previous topic - Next topic

Crivens

Ok so KEY(58) can detect when CAPS LOCK is pressed, but is there a command for detecting what the current status of CAPS LOCK is?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Kitty Hello

not really. Or is it reporting "pressed" when it's down? I don't think SDL offers a way to tell. There might be platform specific APIs to do so, if it's needed.

Ruidesco

#2
According to http://www.libsdl.org/docs/html/guideinputkeyboard.html the CapsLock and NumLock are retrieved in an enabled/disabled fashion rather than pressed/released if you look up the mod parameter rather than the key one.

PS. I guess that ScrollLock works that way too, though that key appears less and less in modern keybs.

Kitty Hello

yeah, who want's a locked scrolling anyway? We want all smooth graphics. </silly_answer>

Moru

Scroll lock is often used for KVM switches to activate the switch of computers. Very handy button since it's almost never used for anything else :-)

erico

Quote from: Kitty Hello on 2012-Jul-19
yeah, who want's a locked scrolling anyway? We want all smooth graphics. </silly_answer>

Unlock your scroll everyonel! :D

Crivens

Ah, it's not the end of the world as it doesn't matter for my mobile devices, and the PC works anyway. I just wanted an onscreen marker to show the caps lock status. I suppose I could look into Windows API calls or somesuch but it's not that big a deal. I just thought there might be a GLB command I missed.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

You would use GetKeyState for Windows...

Crivens

Yeah probably would be best. I used it in VB6 and AutoIT years ago so should be easy enough to convert. And stuff Macs/Linux :) To be honest though there is little to no chance this app will be available on PCs so it's only a nicety for me testing the thing.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

matchy

Like in VB, is there a way to send a key press in run-time back to itself?

MrTAToad

Yes, but its not reliable...  You use the SendKey function in Windows

Crivens

Yeah I used a load of AutoIT scripts years ago to automate logging into our Unix systems (I normally have at least 12 terminal sessions open at one time for my job). Pretty sure I used a lot of SendKey stuff. AutoIT turned out to be a bit friendlier for doing exactly what I wanted(and getting a simple program out to a lot of sites). I think I grabbed the Terminal window handler IDs, switched to them when I wanted to send some key data, and then did SendKey (or whatever it was I used as I'm sure I used SendKey and something else - would check but I can't be bothered getting my Cryptokey from upstairs...).

Works fine apart from you do anything else at the same time as the script and it can be just the right moment between selecting the window with the handler ID and sending the keys. For the life of me couldn't get it to correctly send to a given Terminal's text section, or even read from it. Then again we do use our own in-house written telnet terminal software, and also an SSH program (SNetterm) that seems good at also hiding things from external programs.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.