ETO Textbox press enter key

I have a question how to use the enter key in combination with the TextBox in ETO.

For shipbuilding purpose I made a cross section clipping panel in python.
What I like to do is to select/activate the “Grid Value” TextBox and press the enter key to tricker a switch from frame to coordinate input.

How can I do this?

.TextChanged doesn’t react on the “enter” key when the focus is on the TextBox

    self.m_label_grid = forms.Label(Text = 'Grid Value              : ')
    if Values: self.m_textbox_grid = forms.TextBox(Text = Values[1])
    else: self.m_textbox_grid = forms.TextBox(Text = 'X0')
    self.m_textbox_grid.TextChanged += self.textbox_value_change

TextChanged doesn’t react on the enter key

hi @Nico_de_Meester pls share a code same we can run here.

Hi @Nico_de_Meester,

Handle the TextBox.KeyDown event. In C#, you might do something like this:

var textBox = new TextBox();
textBox.KeyDown += (s, e) =>
{
  if (e.Key == Keys.Enter)
  {
    // TODO...
  }
};

– Dale

Hi Dale,

That was the trick.

thanks.

Nico

# Create controls for the dialog
self.m_label_grid = forms.Label(Text = 'Grid Value              : ')
if Values: self.m_textbox_grid = forms.TextBox(Text = Values[1])
else: self.m_textbox_grid = forms.TextBox(Text = 'X0')
self.m_textbox_grid.ID="1"
self.m_textbox_grid.KeyDown += self.textbox_enterkey
self.m_textbox_grid.TextChanged += self.textbox_value_change

# Start of the class functions
def textbox_enterkey(self, sender,e):
    try:
        if str(e.Key)=="Enter":
            print "Yes Enter pressed"
        else: 
            print "Enter not pressed"
    except:
        print 'Problem enter'