I'm trying to use EVT_LISTBOX to detect when an item is selected. However, when my handler gets the wxCommandEvent event, event.IsSelection() always returns false, indicating a deselection. event.GetSelection(), which the documentation says is not valid for a deselection, nonetheless works and returns the index of the item which was selected, not the index of the item de-selected.
I added event.IsSelection() and event.GetSelection() to EvtListBox in the wxListBox demo, and I get the same results: IsSelection returns false, but GetSelection returns the index of the selected item.
Does anyone else see this behavior? Is it a known bug?
I construct my wxListBox with the wxLB_SINGLE style.
I'm using wxPython 2.3.2.1 with Python 1.5.2 on Win98SE.
I'm trying to use EVT_LISTBOX to detect when an item is selected. However, when my handler gets the wxCommandEvent event, event.IsSelection() always returns false, indicating a deselection. event.GetSelection(), which the documentation says is not valid for a deselection, nonetheless works and returns the index of the item which was selected, not the index of the item de-selected.
I added event.IsSelection() and event.GetSelection() to EvtListBox in the wxListBox demo, and I get the same results: IsSelection returns false, but GetSelection returns the index of the selected item.
Does anyone else see this behavior? Is it a known bug?
Yes and no. Please enter a bug report about this.
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I'm trying to use EVT_LISTBOX to detect when an item is selected. However, when my handler gets the wxCommandEvent event, event.IsSelection() always returns false, indicating a deselection. event.GetSelection(), which the documentation says is not valid for a deselection, nonetheless works and returns the index of the item which was selected, not the index of the item de-selected.
I added event.IsSelection() and event.GetSelection() to EvtListBox in the wxListBox demo, and I get the same results: IsSelection returns false, but GetSelection returns the index of the selected item.
Does anyone else see this behavior? Is it a known bug?