Using Enter key instead of button in ETO forms c#

Hello Rhino Developers,

I am working with Eto Forms, and in the same form, I want to apply changes with ‘enter’ key.

for example : In Rhino, if we have a block - and we want to change its name : (we open block properties → change name → click Enter. and when we are finished with all changes we click OK.

and now I changed the name and clicked on the keyboard enter.

so, How can I use the ‘enter’ key to apply a change for an editable textBox? (without buttons)

thanks in advance,
Hanan

Hi @tanasra,

You might consider subscribing to the KeyDown event and then taking whatever action you want.

– Dale

thanks @Dale for your reply. very helpful.

is there is an example, related to key use (keyEnter) that I can look at?
(I checked the SampleCsEtoOrderCurvesCommand). is there a different example on textbox?
thanks again :smiley:

Adding how I solved it at last :smiley:

textbox.KeyUp += UseKeys; //using keyUp
textbox.KeyDown += UseKeys; //or using KeyDown
      private void UseKeys(object sender, KeyEventArgs e)
      {
          if (e.IsKeyUp(Keys.Enter))
          {
              //do something
          }
      }
1 Like