Sample code for RhinoApp.KeyboardEvent

Hi @dale,

Could you kindly post a sample code for the KeyboardEvent as I would like to track the ‘Delete’ key.

Hi @HepChan,

Here you go:

https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsCommands/SampleCsKeyboardHook.cs

– Dale

thank you @dale

Hi @dale is there a similar example working on macOS as well?
I’m porting an existing plugin (whose dialogs have already been migrated from WinForm to Eto), but we miss a Keyboard listening strategy (that should work similarly to Windows Message Filtering) to intercept keydown/up events and perform some actions accordingly.
We cannot deal with events in a specific dialog, because sometimes shortcuts need to be captured during pushPickButton interaction (when the dialog is hidden or unfocused).

I tried subscribing RhinoApp.KeyboardEvent or RhinoEtoApp.MainWindow.KeyUp but it doesn’t seem to work.

Any suggestion would be appreciated :wink:

Hi @p.stragliotto,

I believe the RhinoApp.KeyboardEvent event works on the Mac. Have you tried?

– Dale