Hi,
I am searching for an easy way to trigger an event, when finishing writing something into a TextCtrl. I know ‘OnExit’ can do that in Delphi, but this is not Delphi. EVT_KILL_FOCUS seems not to work with TextCtrls and is the only thing so far i found.
An alternative would be to let EVT_TEXT only react to user actions (changing something) and not to program actions. But how?
Suggestions?
PS: Weee, at least I got XML reading/writing to work.
PSS: Uhm OffTopic.
Hello Michael,
I don't know on which platform are you on, but for me EVT_KILL_FOCUS works as it should (Windows 2000/XP, wxPython 2.6.2.1). If you want to detect when the user changes the focus from a TextCtrl to something else, it should work. Other way may be to detect an EVT_TEXT_ENTER (the user presses the enter key) and do something when this event fires.
Andrea.
“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.virgilio.it/infinity77
···
----- Original Message -----
From:
Michael Knopf
To: wxPython-users@lists.wxwidgets.org
Sent: Monday, February 13, 2006 12:17 AM
Subject: [wxPython-users] OnExit Event for an TexCtrl?
Hi,
I am searching for an easy way to trigger an event, when finishing writing something into a TextCtrl. I know ‘OnExit’ can do that in Delphi, but this is not Delphi. EVT_KILL_FOCUS seems not to work with TextCtrls and is the only thing so far i found.
An alternative would be to let EVT_TEXT only react to user actions (changing something) and not to program actions. But how?
Suggestions?
Seet this post from earlier today:
http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?11:msp:47719:miebbcjeoepdcgoocmbd
- Josiah
···
Michael Knopf <michael.knopf@gmail.com> wrote:
Hi,
I am searching for an easy way to trigger an event, when finishing writing
something into a TextCtrl. I know 'OnExit' can do that in Delphi, but this
is not Delphi. EVT_KILL_FOCUS seems not to work with TextCtrls and is the
only thing so far i found.
An alternative would be to let EVT_TEXT only react to user actions (changing
something) and not to program actions. But how?
Suggestions?
Hi Andrea, hi Josiah,
it works now, although I do not really understand why.
I have had bound the events like normal buttons:
self.Bind(wx.EVT_MYEVENT,MyFuction,MyObject)
But that does not work for the KILL_FOCUS event (it does for the TEXT event …).
self.MyObject.Bind(wx.EVT_EVENT,MyFunction)
This works (thanks Josiah). But why? Where is the difference?
Thanks so far,
Michael
PS: Grr, have to leave now, school …
From a post later in the thread I linked to before:
http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?11:mss:47722:miebbcjeoepdcgoocmbd
Apparently button events are command events, as seemingly are
wx.EVT_TEXT, but not wx.EVT_KILL_FOCUS, nor wx.EVT_TEXT_ENTER.
I would wager that binding to the object itself always works.
- Josiah
···
Michael Knopf <michael.knopf@gmail.com> wrote:
Hi Andrea, hi Josiah,
it works now, although I do not really understand why.
I have had bound the events like normal buttons:
self.Bind(wx.EVT_MYEVENT,MyFuction,MyObject)
But that does not work for the KILL_FOCUS event (it does for the TEXT event
...).
self.MyObject.Bind(wx.EVT_EVENT,MyFunction)
This works (thanks Josiah). But why? Where is the difference?