Keyboard Events and "KeyboardHookEvent"

I can’t get a keyboard event to trigger. I’ve also noticed that the “KeyboardHookEvent” doesn’t exist on the right in the script editor. Is it no more?

I’m basing my code off the sample:

I’m basically trying to write something to the command line to verify the event triggers to no avail.

@keithscadservices - please review this sample.

SampleCsKeyboardHook.cs

– Dale

As always thanks a bunch Dale. I’m now just figuring out if I should attempt to make this in Python and if it will actually work. I think I’ll answer my own question if I play around enough.

In the old API docs I can get to this page:

But it’s inaccessible in the “new” API docs and technically missing information.

I was confused about the Delegate signature because most delegates are of the (object sender, EventArgs e) format. Having the key as the only argument makes things a lot easier.

Thanks @keithscadservices. I’ve logged the issue.

https://mcneel.myjetbrains.com/youtrack/issue/WWW-2633

– Dale

Thanks Dale! I can’t get this to work in Python yet threw a lot at it. But I’ll try in C#.

It works in C# (but…). I could not get the Python code to work after quite a lot of experimenting.

And the “but”: It recognizes the C# but sends the program into an infinite loop. Overall the behavior is quite erratic and I don’t think this approach is useable unfortunately. I’ll have to think of something else, perhaps the command line string capture?

@keithscadservices I added delegates to the new RhinoCommon documentation website
https://developer.rhino3d.com/api/rhinocommon/rhino.keyboardhookevent

1 Like