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
This commit is contained in:
@@ -161,6 +161,9 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_macIsUserPane = FALSE ;
|
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) )
|
if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -646,6 +649,15 @@ void wxListBox::MacClear()
|
|||||||
void wxListBox::MacSetSelection( int n , bool select )
|
void wxListBox::MacSetSelection( int n , bool select )
|
||||||
{
|
{
|
||||||
UInt32 id = m_idArray[n] ;
|
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 )
|
if ( ::IsDataBrowserItemSelected( (ControlRef) m_macControl , id ) != select )
|
||||||
{
|
{
|
||||||
verify_noerr(::SetDataBrowserSelectedItems((ControlRef) m_macControl , 1 , & id , kDataBrowserItemsToggle ) ) ;
|
verify_noerr(::SetDataBrowserSelectedItems((ControlRef) m_macControl , 1 , & id , kDataBrowserItemsToggle ) ) ;
|
||||||
|
Reference in New Issue
Block a user