Double event fire from wxTextCtrl

OK, this is rather simple, but can anyone tell me why this is happening??

I have reduced my app to a very simple case (attached). When run, and the slider is dragged, page up/down, or line up/down, the text control fires two events, even thought I am only calling SetValue() once! Why is this??

My concern is, I am sending data serially to another device which interrupts a process to accept the data. Currently, it is getting two interrupts (the same value is sent twice) when it only needs to get one - and is wasting processing time. Is there any way around this?

Any help is appreciated.

BTW, I am using wxPython 2.3.4.2

Thanks,
Mark.

test.py (3.76 KB)

Hi Mark,

on wich OS do you work?
I had a try with Py 2.2, wxPython 2.3.4.2 on SuSE Linux 8.0 and the event
wasn't fired twice.

I had nearly the same Problem with some MessageDialogs that opened twice.
The Error disappeared after deletion of all event.Skip() commands. But I saw
that these are commented out in yout code...

Sorry, but I have no further advice for you... it works on my machine...

Bye,

Bjoern

···

Am Montag, 13. Januar 2003 18:10 schrieb Mark Melvin:

OK, this is rather simple, but can anyone tell me why this is happening??

I have reduced my app to a very simple case (attached). When run, and
the slider is dragged, page up/down, or line up/down, the text control
fires two events, even thought I am only calling SetValue() once! Why
is this??

My concern is, I am sending data serially to another device which
interrupts a process to accept the data. Currently, it is getting two
interrupts (the same value is sent twice) when it only needs to get one
- and is wasting processing time. Is there any way around this?

Any help is appreciated.

BTW, I am using wxPython 2.3.4.2

Thanks,
Mark.

--
small office solutions
info@sosnetz.de - http://www.sosnetz.de

Damn, I always forget the OS details. I am running Python 2.2.1, wxPython 2.3.4.2, on Windows 2000 SP2.

Thanks for trying. Hmm, I should try it tonight on Linux at home. May be a Windows thing. As you noticed, I did try commenting out the event.Skip()'s, but it didn't change anything.

Mark.

Björn Platzen wrote:

···

Hi Mark,

on wich OS do you work?
I had a try with Py 2.2, wxPython 2.3.4.2 on SuSE Linux 8.0 and the event wasn't fired twice.

I had nearly the same Problem with some MessageDialogs that opened twice.
The Error disappeared after deletion of all event.Skip() commands. But I saw that these are commented out in yout code...

Sorry, but I have no further advice for you... it works on my machine...

Bye,

Bjoern

Am Montag, 13. Januar 2003 18:10 schrieb Mark Melvin:

OK, this is rather simple, but can anyone tell me why this is happening??

I have reduced my app to a very simple case (attached). When run, and
the slider is dragged, page up/down, or line up/down, the text control
fires two events, even thought I am only calling SetValue() once! Why
is this??

My concern is, I am sending data serially to another device which
interrupts a process to accept the data. Currently, it is getting two
interrupts (the same value is sent twice) when it only needs to get one
- and is wasting processing time. Is there any way around this?

Any help is appreciated.

BTW, I am using wxPython 2.3.4.2

Thanks,
Mark.
   

Mark Melvin wrote:

OK, this is rather simple, but can anyone tell me why this is happening??

I have reduced my app to a very simple case (attached). When run, and the slider is dragged, page up/down, or line up/down, the text control fires two events, even thought I am only calling SetValue() once! Why is this??

My concern is, I am sending data serially to another device which interrupts a process to accept the data. Currently, it is getting two interrupts (the same value is sent twice) when it only needs to get one - and is wasting processing time. Is there any way around this?

Any help is appreciated.

BTW, I am using wxPython 2.3.4.2

On which platform?

My guess is that it is Windows. Why? Because it's native text control seems to behave in subtly different ways on every version of windows and/or Service pack... There isn't supposed to be any EVT_TEXT when calling SetValue, only when the value is changed by the user. I think that if you use the wxTE_RICH style then it will behave a bit better.

···

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

Robin Dunn wrote:

Mark Melvin wrote:

OK, this is rather simple, but can anyone tell me why this is happening??

I have reduced my app to a very simple case (attached). When run, and the slider is dragged, page up/down, or line up/down, the text control fires two events, even thought I am only calling SetValue() once! Why is this??

My concern is, I am sending data serially to another device which interrupts a process to accept the data. Currently, it is getting two interrupts (the same value is sent twice) when it only needs to get one - and is wasting processing time. Is there any way around this?

Any help is appreciated.

BTW, I am using wxPython 2.3.4.2

On which platform?

My guess is that it is Windows. Why? Because it's native text control seems to behave in subtly different ways on every version of windows and/or Service pack... There isn't supposed to be any EVT_TEXT when calling SetValue, only when the value is changed by the user. I think that if you use the wxTE_RICH style then it will behave a bit better.

Once again, I bow to the master.... Adding wxTE_RICH works, but as you said - SetValue no longer generates an EVT_TEXT. So I added one with wxPostEvent, and it works fine. Thanks, Robin.

Mark