Dear list,
For security purposes i need to check the data that i put into the text
controls of my dialog. Therefore i use handlers like EVT_TEXT(self,
ID_MY_TEXT_CTRL, self.OnChangeText) in my class that is derived from
wxFrame. OnChangeText looks similary to this:
This call shows different behaviors on different machines: if myString takes
more than 1024 characters the program hangs up with a stack overflow. I
noticed that with more than 1024 characters in the string SetValue() seems
to call the callback consistently. I tested on two machines, both
identically installed with WindowsXP, Python 2.2.3, wxPython 2.4.2.4 and
win32all 1.6.2. On the first PC it worked regardless of the string's length.
The callback gets called about 6 or 7 times but then it calms again. On the
second one it crashes badly (i.e. if you don't feed a print statement or
something like that to OnChangeText you will not even get a traceback!)
after a series of calls.
Can anyone out there reproduce what i'm talking about and help me?
Best regards
Oliver
Dear list,
For security purposes i need to check the data that i put into the text
controls of my dialog. Therefore i use handlers like EVT_TEXT(self,
ID_MY_TEXT_CTRL, self.OnChangeText) in my class that is derived from
wxFrame. OnChangeText looks similary to this:
This call shows different behaviors on different machines: if myString takes
more than 1024 characters the program hangs up with a stack overflow. I
noticed that with more than 1024 characters in the string SetValue() seems
to call the callback consistently. I tested on two machines, both
identically installed with WindowsXP, Python 2.2.3, wxPython 2.4.2.4 and
win32all 1.6.2. On the first PC it worked regardless of the string's length.
The callback gets called about 6 or 7 times but then it calms again. On the
second one it crashes badly (i.e. if you don't feed a print statement or
something like that to OnChangeText you will not even get a traceback!)
after a series of calls.
One possibility could be that the SetValue is causing another recursive EVT_TEXT on the one machine (or perhaps some other difference such as different order of the events.) This can be caused by different versions of the native controls as MS is sometimes highly inconsistent at the low level things. The best thing to do would be to set a flag before the SetValue and then check it at the begining of OnChangeText and do nothing if it is set.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!