[wxPython] wxTextCtrl and EVT_TEXT + no wxPanel.FindFocus()

I am trying to tie the values of two wxTextCtrls together, i.e. when the
first control's text is changed, it changes the second control and vice
versa. The problem is that calling wxTextCtrl.SetValue() triggers EVT_TEXT,
which updates the other control which again triggers EVT_TEXT.... you get the
idea. This behavior is consistent with the docs, but how can I get around it?
I was going to put a test at the beginning of the event handler to see if
event.GetId() == panel.FindFocus().GetId(), but apparently wxPanel lacks
this method (even though it's derived from wxWindow, which has it ???)

Any suggestions?

···

--
Cliff Wells
Software Engineer
Logiplex Corporation
(800) 735-0555

I am trying to tie the values of two wxTextCtrls together, i.e. when the
first control's text is changed, it changes the second control and vice
versa. The problem is that calling wxTextCtrl.SetValue() triggers

EVT_TEXT,

which updates the other control which again triggers EVT_TEXT.... you get

the

idea. This behavior is consistent with the docs, but how can I get around

it?

I was going to put a test at the beginning of the event handler to see if
event.GetId() == panel.FindFocus().GetId(), but apparently wxPanel lacks
this method (even though it's derived from wxWindow, which has it ???)

Any suggestions?

FindFocus is static in C++ so it is accessed as wxWindow_FindFocus in
wxPython.

The way I usually handle situations like the above is have a guard flag that
I set to true while updating and the ensure that it's not true when entering
effected event handlers.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Never mind.... wxWindow_FindFocus()

···

On Tuesday 07 August 2001 15:39, I wrote:

I was going to put a test at the beginning of the event
handler to see if event.GetId() == panel.FindFocus().GetId(), but
apparently wxPanel lacks this method (even though it's derived from
wxWindow, which has it ???)

Any suggestions?

--
Cliff Wells
Software Engineer
Logiplex Corporation
(800) 735-0555

hi

···

--On Dienstag, 7. August 2001 15:39 -0700 Cliff Wells <logiplexsoftware@earthlink.net> wrote:

I am trying to tie the values of two wxTextCtrls together, i.e. when the
first control's text is changed, it changes the second control and vice
versa. The problem is that calling wxTextCtrl.SetValue() triggers
EVT_TEXT, which updates the other control which again triggers
EVT_TEXT.... you get the idea.

What about to check the value of the other control before calling .SetValue()??? if its equal you don't need to change...

cya, da horrible neglish writin' kid

----
Rene Freund nur ein toter bug ist ein guter bug
rene@meder.de