EVT_TEXT firing unexpectedly?

I’ve bound EVT_TEXT to a TextCtrl and it seemed to be working fine, however for some debugging I added some print statements dotted around the code and have discovered that the EVT_TEXT handler fires a lot of times with no text being entered. For instance it fires 8 times when the application starts up, and nothing is entered in the TextCtrl. Does anyone have any experience of this behaviour?

Hi,

···

On Wed, Apr 4, 2012 at 9:59 AM, johnharris85 <john@johnharris.tv> wrote:

I've bound EVT_TEXT to a TextCtrl and it seemed to be working fine, however
for some debugging I added some print statements dotted around the code and
have discovered that the EVT_TEXT handler fires a lot of times with no text
being entered. For instance it fires 8 times when the application starts up,
and nothing is entered in the TextCtrl. Does anyone have any experience of
this behaviour?

Platform and wx version?

Are you setting a default value on the text control at startup? Don't
remember exactly but EVT_TEXT may get fired when ever text changes in
the control, whether entered via keyboard or programmaticly.

Cody

Windows 7, wx2.8.12

http://bpaste.net/show/26497/

That’s the relevant code, nothing else interacts with the TextCtrl until the user enters text.

John

···

On Wednesday, 4 April 2012 16:08:26 UTC+1, Cody Precord wrote:

Hi,
On Wed, Apr 4, 2012 at 9:59 AM, johnharris85 john@johnharris.tv wrote:

I’ve bound EVT_TEXT to a TextCtrl and it seemed to be working fine, however
for some debugging I added some print statements dotted around the code and
have discovered that the EVT_TEXT handler fires a lot of times with no text
being entered. For instance it fires 8 times when the application starts up,
and nothing is entered in the TextCtrl. Does anyone have any experience of
this behaviour?

Platform and wx version?

Are you setting a default value on the text control at startup? Don’t
remember exactly but EVT_TEXT may get fired when ever text changes in
the control, whether entered via keyboard or programmaticly.

Cody

http://wiki.wxpython.org/DoNotTopPost
http://wiki.wxpython.org/MakingSampleApps

···

On 4/4/12 8:13 AM, johnharris85 wrote:

Windows 7, wx2.8.12

http://bpaste.net/show/26497/

That's the relevant code, nothing else interacts with the TextCtrl until
the user enters text.

--
Robin Dunn
Software Craftsman