]> git.saurik.com Git - wxWidgets.git/commitdiff
don't change the combobox text when it's being resized (see #10126)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Jan 2009 19:08:33 +0000 (19:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Jan 2009 19:08:33 +0000 (19:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/combobox.cpp

index 5faed26cb54965906280413dfc47464a2dce36f6..ca40d744fc56cea493733b7e4658ce687a1ae27c 100644 (file)
@@ -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);