From: Vadim Zeitlin Date: Sun, 25 Jan 2009 19:08:33 +0000 (+0000) Subject: don't change the combobox text when it's being resized (see #10126) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/428f8b0610b93a8de0c8a17fa3de31eed30cdd5a don't change the combobox text when it's being resized (see #10126) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- 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);