[wxPython-users] ListCtrl, selection, MS Windows

Robin Dunn robin at alldunn.com
Mon Jan 1 12:23:46 PST 2007


Basil Shubin wrote:
> Happy New Year!
> 
> For the provided source code example, I have discover some strange 
> behavior. On linux box, selection works as it should be work, but under 
> windows when I select item in list control, the selection first shown, 
> but then disappear. I don't understand why it's work fine under 
> Linux/GTK, but fail under Windows... Please, I need help in tracing this 
> issue.

It probably has something to do with the fact that every time something 
is selected you are removing all the items from the list and adding them 
again.  So the selection happens and then you delete all items 
(including the selected one) and then try to select it again.  Then the 
mouse up event happens and the native control processes that in whatever 
way it does, and since the original item selected on the mouse down 
doesn't exist any more then it deselects the current selection.  I bet 
if you don't remove and re-add all the contents upon the selection event 
then things will work fine.

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





More information about the wxpython-users mailing list