X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4a11fe85cb632368ba8426204598806460b7679..e5ef1cae0f424be0bffbd651cb10052dfb208396:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 9eec9c2332..7b73e6f6f1 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -158,6 +158,21 @@ bool wxChoice::CreateAndInit(wxWindow *parent, return true; } +void wxChoice::SetLabel(const wxString& label) +{ + if ( FindString(label) == wxNOT_FOUND ) + { + // unless we explicitly do this here, CB_GETCURSEL will continue to + // return the index of the previously selected item which will result + // in wrongly replacing the value being set now with the previously + // value if the user simply opens and closes (without selecting + // anything) the combobox popup + SetSelection(-1); + } + + wxChoiceBase::SetLabel(label); +} + bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,