EVT_TEXT_ENTER can not be caught in a subclass of wx.Dialog
Cliff Wells
clifford.wells at comcast.net
Wed Oct 13 06:20:19 EDT 2004
On Tue, 2004-10-12 at 04:32 -0700, Sean wrote:
> Hi,
> I found if a wx.TextCtrl is used in a subclass of wx.Dialog, the
> event wx.EVT_TEXT_ENTER can not be caught, that is, key code of RETURN
> can not be indentified.
>
> class MyDialog(wx.Dialog):
> def __init__(self,parent,pos,size,style):
> ...
> self.t1 = wx.TextCtrl(self, -1, "", size=(125, -1))
> self.t1.Bind(wx.EVT_CHAR, self.OnChar,self.t1)
> ...
>
> def OnChar(self, event):
> if (event.GetKeyCode() == 13):
> print "%d"%event.GetKeyCode()
> else:
> print "%d"%event.GetKeyCode()
> event.Skip()
>
>
> How could I effectively bind a handler to EVT_TEXT_ENTER in it?
You need to specify the following style for the textctrl:
self.t1 = wx.TextCtrl(self, -1, "", style = wx.TE_PROCESS_ENTER)
Regards,
Cliff
--
Cliff Wells <clifford.wells at comcast.net>
More information about the Python-list
mailing list