Forum > Cocoa
How to set Capslock or ScrollLock or NumLock under macOS
(1/1)
Key-Real:
Hi,
how can I toggle Capslock or ScrollLock or NumLock under MacOS?
KodeZwerg:
May I ask for what purpose?
I would be very confused if an application change my System (Keyboard is part of my system)
Maybe there is a better solution if you describe what you aim for?
Key-Real:
I need to perform an action on pressing the CapsLock Key.
If I press it, the keyboard NSKeyDown event came. The LED on this key light up.
I have a boolean buffer for the whole keyboard. It stores if a key is pressed or not.
He trows me that CapsLock is pressed the whole time(no KeyUp event).
So I need to set the CapsLock off. So he can perform the NSKeyUp.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- case myType of NSKeyDown : if event.keycode < 256 then keyboard[event.keycode]:=true; NSKeyUp : if event.keycode < 256 then keyboard[event.keycode]:=false; NSFlagsChanged : if event.keycode < 256 then keyboard[event.keycode]:=not keyboard[event.keycode]; NSLeftMouseDown: mouseL:=true; NSRightMouseDown: mouseR:=true; NSLeftMouseUp: mouseL:=false; NSRightMouseUp: mouseR:=false; NSScrollWheel : mouseWheel:=round(event.deltaY); end;
Or you knew a better solution?
AND (as we are at this topic)
If I press CapsLock very shortly nothing happens. We waits a little time before raise the event(the LED goes on).
How to get rid of this delay?
Navigation
[0] Message Index