EVT_TEXT_ENTER from Toolbar TextCtrl

Shouldn’t this generate an EVT_TEXT_ENTER when I put some text in the field and hit enter?

toolbar.AddControl(wx.TextCtrl(toolbar, 1109, “”, wx.DefaultPosition
, wx.Size(140, -1)))
self.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter, id = 1109)

def OnTextEnter(self, event):

print 'why wont this work'

It doesn’t want to work for me. Thanks, Mike Barron

Thanks, works fine now. Mike

···

On Dec 4, 2007 1:52 AM, C M cmpython@gmail.com wrote:

On Dec 3, 2007 9:51 PM, Michael Barron barronmo@gmail.com wrote:

Shouldn’t this generate an EVT_TEXT_ENTER when I put some text in the field and hit enter?

toolbar.AddControl(wx.TextCtrl(toolbar, 1109, “”, wx.DefaultPosition
, wx.Size(140, -1)))
self.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter, id = 1109)

def OnTextEnter(self, event):

print 'why wont this work'

It doesn’t want to work for me. Thanks, Mike Barron

You need to set the style to allow the textctrl to process an enter. If it’s a
multiline textbox and you want it to make it go to the next line too, you need
that style too. Try:

toolbar.AddControl(wx.TextCtrl(toolbar, 1109, “”, wx.DefaultPosition
, wx.Size(140, -1),style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE))