From 5e6f42cdf9664e556d2bbe5ba56ef13be9c02733 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 1 Apr 2004 15:43:41 +0000 Subject: [PATCH] Assert for incorrect style, added Deselection for single selection lists git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/listbox.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index f371474e39..ff4dc28ea2 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -160,6 +160,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxString& name) { m_macIsUserPane = FALSE ; + + wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED), + _T("only one of listbox selection modes can be specified") ); if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) ) return false; @@ -646,6 +649,15 @@ void wxListBox::MacClear() void wxListBox::MacSetSelection( int n , bool select ) { UInt32 id = m_idArray[n] ; + if ( !(GetWindowStyle() & (wxLB_MULTIPLE|wxLB_EXTENDED) ) ) + { + int n = MacGetSelection() ; + if ( n >= 0 ) + { + UInt32 idOld = m_idArray[n] ; + SetDataBrowserSelectedItems((ControlRef) m_macControl , 1 , & idOld , kDataBrowserItemsRemove ) ; + } + } if ( ::IsDataBrowserItemSelected( (ControlRef) m_macControl , id ) != select ) { verify_noerr(::SetDataBrowserSelectedItems((ControlRef) m_macControl , 1 , & id , kDataBrowserItemsToggle ) ) ; -- 2.45.2