wx.EVT_LIST_ITEM_(DE)SELECTED called twice on Windows for a wx.ListCtrl ?

There it is :wink:
In fact, when the List Control is in a Notebook page, the selected event is fired twice on Windows. If the List Control is not in the notebook, everything works fine.

Matthieu

PypelineBookPage.py (2.45 KB)

test.png

路路路

2007/5/15, Robin Dunn robin@alldunn.com:

Matthieu Brucher wrote:

Hi,

I鈥檓 getting back to wxPython and I鈥檓 trying to do some GUI code with
ListCtrl.
I鈥檓 binding wx.EVT_LIST_ITEM_SELECTED to self.onSelect, same for

deselection and I鈥檓 keeping a list of currently selected elements.
Everything works fine on Linux (Python 2.4, wxPython 2.6, thanks to
FC5), but on Windows (Python 2.5, wxPython 2.8.3), my event is called

twice, for the selection and the deselection of an element, so each
element is twice in the selected elements.
Is this a know behaviour ?

Please send a small sample app that shows the problem.

Matthieu Brucher wrote:

2007/5/15, Robin Dunn <robin@alldunn.com <mailto:robin@alldunn.com>>:

    Matthieu Brucher wrote:
     > Hi,
     >
     > I'm getting back to wxPython and I'm trying to do some GUI code with
     > ListCtrl.
     > I'm binding wx.EVT_LIST_ITEM_SELECTED to self.onSelect, same for
     > deselection and I'm keeping a list of currently selected elements.
     > Everything works fine on Linux (Python 2.4, wxPython 2.6, thanks to
     > FC5), but on Windows (Python 2.5, wxPython 2.8.3), my event is
    called
     > twice, for the selection and the deselection of an element, so each
     > element is twice in the selected elements.
     > Is this a know behaviour ?

    Please send a small sample app that shows the problem.

There it is :wink:
In fact, when the List Control is in a Notebook page, the selected event is fired twice on Windows. If the List Control is not in the notebook, everything works fine.

Not sure yet what the cause is, but the workaround is easy. Don't call event.Skip in those handlers.

路路路

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

Not sure yet what the cause is, but the workaround is easy. Don鈥檛 call
event.Skip
in those handlers.

Thanks, that was obvious, I didn鈥檛 think about it :wink:

Matthieu