Using C#, how do I enable the user press the Escape button to stop a process from happening? Rhino student needs help!

I have an infinite while loop in my code drawing a random increasing curve. At any given time I want to press escape to stop the process, but when I use the GetString() function it stops the background process, at least until I press Enter again. I tried using Windows.Form, but that didn’t work. How can I accomplish my goal?

There is an event in RhinoCommon called EscapePressed

You can find more info here

Generally, you can find info on RhinoCommon here

Are there any examples of code using this event? I’m not too familiar with
the event types in C# yet.

Also, does it work similar to RhinoApp.KeyboardEventHandler?

1 Like

Hello @dale , this link dont work, can you post another?