TextCtrl focus events in wxWidgets

Frank Millman frank at chagford.com
Wed Jul 19 07:19:41 EDT 2006


Simon Hibbs wrote:
> Steve Holden wrote:
>
> > It should be quite simple: you need to handle EVT_SET_FOCUS and/or
> > EVT_KILL_FOCUS events (documented in the wxPython docs) to know when to
> > recaclulate the values. Sounds like that should be enough of a hint to you.
>
> I've tried that, but it doesn't work. Here is the test code:
>
>     self.PlantCtrl = wx.TextCtrl(self, -1, "")
>
>     self.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl,
> self.PlantCtrl)
>
>     def OnUpdatePlantCtrl(self, event):
>         print "set Plant"
>
> When the control loses focus, I don't get the message in the console.
> I'm trapping other events successfuly elsewhere using similar code.
>
> Simon Hibbs
>

Try self.PlantCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl)

Frank Millman




More information about the Python-list mailing list