I have a multiline wx.TextCtrl. When I highlight several characters and then paste using Ctrl + V or the context menu, it seems to be firing two EVT_TEXT events. Moreover, a call to MyTextCtrl.GetValue() returns the wrong value on the first event (includes both the originally highlighted text and the pasted text), but the right value on the second. I don’t see the same behaviour when I highlight, then replace the highlighted characters with a single keystroke. Nor do I get two EVT_TEXTs when I paste with a non-extended cursor (i.e. no characters highlighted).
Is this a known issue? As a workaround, is there any way to detect that the current event is a paste-over-highlight, so that I can tell my code to ignore the first EVT_TEXT?
Platform: Fedora Linux 16, KDE 4.8.4
Python version: 2.7.3, wxpython version: 2.8.12.0
I'm not sure if anything can be done about it since pasting (and the events generated from it) is handled by the gtk widget itself, but create a ticket at trac.wxwidgets.org about it and let's see. Set the component field on the ticket to wxGTK.
···
On 8/12/12 5:17 AM, Peter Clarke wrote:
I have a multiline wx.TextCtrl. When I highlight several characters and
then paste using Ctrl + V or the context menu, it seems to be firing two
EVT_TEXT events. Moreover, a call to MyTextCtrl.GetValue() returns the
wrong value on the first event (includes both the originally highlighted
text and the pasted text), but the right value on the second. I don't
see the same behaviour when I highlight, then replace the highlighted
characters with a single keystroke. Nor do I get two EVT_TEXTs when I
paste with a non-extended cursor (i.e. no characters highlighted).
Is this a known issue? As a workaround, is there any way to detect that
the current event is a paste-over-highlight, so that I can tell my code
to ignore the first EVT_TEXT?
Platform: Fedora Linux 16, KDE 4.8.4
Python version: 2.7.3, wxpython version: 2.8.12.0