X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8316ff5d98f14f8d39fbe15a7fb9248e1f1194f4..6e2fef031b643ceda4ff4bd6f1920ecb20780c6e:/src/generic/choicdgg.cpp?ds=sidebyside 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]); }