From 6c6ea7bed145bc5bb8a5c9ac3704af914ca57171 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Oct 2004 01:03:02 +0000 Subject: [PATCH] remove the selection when SetSelection(-1) is called instead of asserting (as documented) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29960 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/listbox.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 3ed2418065..ba5b33e446 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -439,6 +439,21 @@ void wxListBox::Clear() void wxListBox::SetSelection(int N, bool select) { + if ( N == wxNOT_FOUND ) + { + // unselect everything + int sel = MacGetSelection() ; + if ( sel != wxNOT_FOUND ) + { + UInt32 id = sel + 1 ; + verify_noerr( + m_peer->SetSelectedItems( 1 , & id , kDataBrowserItemsRemove ) + ); + } + + return; + } + wxCHECK_RET( N >= 0 && N < m_noItems, wxT("invalid index in wxListBox::SetSelection") ); MacSetSelection( N , select ) ; -- 2.45.2