From d0cc483d1739bb355a9deb6e0f56c0eb3a5f5f97 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Jul 2004 15:06:58 +0000 Subject: [PATCH] unselect previously selected items in SetSelection() (patch 974326) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/choicdgg.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index a71dd76d5c..15e85bb44a 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -457,8 +457,17 @@ bool wxMultiChoiceDialog::Create( wxWindow *parent, void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections) { - size_t count = selections.GetCount(); - for ( size_t n = 0; n < count; n++ ) + // first clear all currently selected items + size_t n, + count = m_listbox->GetCount(); + for ( n = 0; n < count; ++n ) + { + m_listbox->Deselect(n); + } + + // now select the ones which should be selected + count = selections.GetCount(); + for ( n = 0; n < count; n++ ) { m_listbox->Select(selections[n]); } -- 2.45.2