[wxPython-users] EVT_TEXT_ENTER from Toolbar TextCtrl

Michael Barron barronmo at gmail.com
Tue Dec 4 17:03:50 PST 2007


Thanks, works fine now.  Mike

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

>
>
> On Dec 3, 2007 9:51 PM, Michael Barron <barronmo at 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 =3D 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=3Dwx.TE_PROCESS_ENTER | wx.TE_MULTILINE))
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200712=
04/ae3452f6/attachment.htm


More information about the wxpython-users mailing list