fix for [ 950550 ] wxChoice - wxEmptyString (wxChoice::FindString doesn't work with empty strings) - confirmed on win2k
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fde548e2d2
commit
4cd1ed991c
@ -333,10 +333,26 @@ int wxChoice::FindString(const wxString& s) const
|
||||
|
||||
return wxNOT_FOUND;
|
||||
#else // !Watcom
|
||||
int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
|
||||
(WPARAM)-1, (LPARAM)s.c_str());
|
||||
//TODO: Evidently some MSW versions (all?) don't like empty strings
|
||||
//passed to SendMessage, so we have to do it ourselves in that case
|
||||
if ( s.size() == 0 )
|
||||
{
|
||||
int count = GetCount();
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
if ( GetString(i).size() == 0 )
|
||||
return i;
|
||||
}
|
||||
|
||||
return pos == LB_ERR ? wxNOT_FOUND : pos;
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
|
||||
(WPARAM)-1, (LPARAM)s.c_str());
|
||||
|
||||
return pos == LB_ERR ? wxNOT_FOUND : pos;
|
||||
}
|
||||
#endif // Watcom/!Watcom
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user