Corrected FindString
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user