TextCtrl focus events in wxWidgets
rony steelandt
bucodi at yahoo.fr
Wed Jul 19 08:35:04 EDT 2006
Since the event handler of a textctrl inherits from wxCommandEvent,
I would guess that the binding should be to EVT_COMMAND_KILL_FOCUS
Not tested...
Rony
Le Wed, 19 Jul 2006 03:15:36 -0700, Simon Hibbs a écrit :
>
> 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
> .
More information about the Python-list
mailing list