From 429bf2309b2d708c2ba4710142ed6ec938e224b1 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 8 Apr 2006 14:58:08 +0000 Subject: [PATCH] Corrected FindString git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/listbox.cpp | 42 +++----------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index ca7866655a..9675f1f117 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -390,46 +390,10 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) int wxListBox::FindString(const wxString& s, bool bCase) const { - if ( s.Right(1) == wxT("*") ) + for ( size_t i = 0 ; i < m_noItems ; ++ i ) { - wxString search = s.Left( s.length() - 1 ) ; - int len = search.length() ; - Str255 s1 , s2 ; - wxMacStringToPascal( search , s2 ) ; - - for ( unsigned int i = 0 ; i < m_noItems ; ++ i ) - { - wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ; - - if ( EqualString( s1 , s2 , bCase , false ) ) - return (int)i; - } - - if ( s.Left(1) == wxT("*") && s.length() > 1 ) - { - wxString st = s ; - st.MakeLower() ; - - for ( unsigned int i = 0 ; i < m_noItems ; ++i ) - { - if (GetString(i).Lower().Matches(st) ) - return (int)i ; - } - } - } - else - { - Str255 s1 , s2 ; - - wxMacStringToPascal( s , s2 ) ; - - for ( unsigned int i = 0 ; i < m_noItems ; ++ i ) - { - wxMacStringToPascal( m_stringArray[i] , s1 ) ; - - if ( EqualString( s1 , s2 , bCase , false ) ) - return (int)i ; - } + if (s.IsSameAs(GetString(i), bCase)) + return (int)i ; } return wxNOT_FOUND; -- 2.45.2