From 6b06a7271f80f6823a6ebe5ca0960db5413b289a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Thu, 5 Jul 2007 22:50:21 +0000 Subject: [PATCH] reset selection when sorting the items as they don't make sense after items change order any more and not doing this could also result in having more than one selected item in a single selection control git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47176 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 643b67245c..627f683f44 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4810,6 +4810,11 @@ int LINKAGEMODE list_ctrl_compare_func_1( wxListLineData **arg1, wxListLineData void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data ) { + // selections won't make sense any more after sorting the items so reset + // them + HighlightAll(false); + ResetCurrent(); + list_ctrl_compare_func_2 = fn; list_ctrl_compare_data = data; m_lines.Sort( list_ctrl_compare_func_1 ); -- 2.47.2