Um:
https://www.w3schools.com/howto/howto_j ... pslock.asp
-
detecting capslock key down
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Posts: 617
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: detecting capslock key down
As far as old OSX /macOS (reading up on the latest it seems iOS/mac Catalyst might be different) I believe that is correct (probably more correct to say it has *NOT been programmed to) as a default fro certain special keys. I'm trying to find where I read that on Apple's dev site in the documentation for Event Handling, NSEvent or NSResponder maybe. That was true by default for certain special keys like the media keys Play/Pause/Stop/etc. Eject and the Power Button (which brings up the Finder shutdown dialog). That does not mean that a driver level thing like ControllerMate that comes with a Kernel Extension, or maybe LCB HIDAPI library (shameless plug) that can poll, can't still respond.richmond62 wrote: ↑Sun Aug 29, 2021 7:26 pmSo, macOS does pick up raw key signals when keys are depressed, it has been programmed NOTthe macOS does not forward certain special key signals
to pass ones on, unlike with Windows and Linux.
Where there's a will there's a way:
https://stackoverflow.com/questions/388 ... -pause-key
https://developer.apple.com/library/arc ... index.html
I'm not sure that CapsLock, that modifies other keys, actually sends it's own key up/down signals (I think it doesn't), but you can certainly check it's state.
Last edited by PaulDaMacMan on Mon Aug 30, 2021 9:34 pm, edited 1 time in total.
-
- Posts: 617
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: detecting capslock key down
Ummm, that looks like JavaScript which is interpreted inside of a runloop of something else (a WebBrowser typically), which could be doing it's own polling of the capsLock state. As you can see here in the link from that page, macOS' Safari browser is shown as compatible and that JS seems to require some other key/mouse event to trigger it:richmond62 wrote: ↑Sun Aug 29, 2021 7:59 pmUm:
https://www.w3schools.com/howto/howto_j ... pslock.asp
-
SShot 2021-08-29 at 21.59.27.png
https://www.w3schools.com/jsref/event_m ... rstate.asp
You can do that in LiveCode Script on macOS too and I know this because I've done it.
Here I have a loop checking the keysDown and capsLock (which I had set to shift notes down by a fifth):
https://www.youtube.com/watch?v=s_knX8mJg1c