]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't set value unnecessarily in wxSpinCtrl::Create() in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Mar 2012 00:29:51 +0000 (00:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Mar 2012 00:29:51 +0000 (00:29 +0000)
This is not only unnecessary but also results in an unexpected event (which
could be avoided by using ChangeValue() but why bother calling it at all if we
don't need to).

Closes #13589.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70800 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/spinctrl.cpp

index 7d79dc76d9a2a3e208000bafa5a4757ab17f0116..7919453f856fe706c9a608987c7a8891b8a0d3a0 100644 (file)
@@ -394,14 +394,15 @@ bool wxSpinCtrl::Create(wxWindow *parent,
     // Set the range in the native control
     SetRange(min, max);
 
-    if ( !value.empty() )
+    // If necessary, set the textual value. Don't do it if it's the same as the
+    // numeric value though.
+    if ( value != wxString::Format("%d", initial) )
     {
         SetValue(value);
         m_oldValue = (int) wxAtol(value);
     }
     else
     {
-        SetValue(wxString::Format(wxT("%d"), initial));
         m_oldValue = initial;
     }