X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3b14872bca4ee65d1adf3c6d75ef66c5438aac..27d77a5990d815f5cd7a31ee4c7cb680eec64d54:/src/msw/combobox.cpp diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 5faed26cb5..ca40d744fc 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -39,6 +39,7 @@ #endif #include "wx/clipbrd.h" +#include "wx/wupdlock.h" #include "wx/msw/private.h" #if wxUSE_TOOLTIPS @@ -233,8 +234,23 @@ WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara long fromOld, toOld; GetSelection(&fromOld, &toOld); + + // if an editable combobox has a not empty text not from the + // list, it tries to autocomplete it from the list when it is + // resized, but we don't want this to happen as it doesn't seem + // to make any sense, so we forcefully restore the old text + wxString textOld; + if ( !HasFlag(wxCB_READONLY) && GetCurrentSelection() == -1 ) + textOld = GetValue(); + + // eliminate flickering during following hacks + wxWindowUpdateLocker lock(this); + WXLRESULT result = wxChoice::MSWWindowProc(nMsg, wParam, lParam); + if ( !textOld.empty() && GetValue() != textOld ) + SetLabel(textOld); + long fromNew, toNew; GetSelection(&fromNew, &toNew);