Control keydown event

How do I subscribe to the events of the Ctrl key?

I know about the RhinoApp.KeyBoardEvent event, but:

  1. Is this interface a bit too simple?
  2. This interface cannot directly know whether the Ctl key is pressed

Hi @ken_zhang,

On Windows, RhinoApp.KeyBoardEvent is just a wrapper for SetWindowsHookEx with the WH_KEYBOARD hook. If you need to know if the Ctrl key is down at the same time as a keyboard event, then you’ll need to p/invoke the GetKeyState Win32 function and test for the VK_CONTROL virtual key.

Just curious, why are you monitoring keyboard events?

– Dale

2 Likes

We want to implement a much more complex undo-redo mechanism than Rhino itself. Currently, we directly intercept the Undo command to achieve this.