Old API depreciated. Use of new API. Source cleaning.
[wxWidgets.git] / src / msw / spinbutt.cpp
index 81857170d47fddb0c1cace77c9e246a59b0d7fa7..6e1ae0e4e5753d5da123e6a43585f59b6100a65e 100644 (file)
@@ -220,16 +220,22 @@ wxSize wxSpinButton::DoGetBestSize() const
 
 int wxSpinButton::GetValue() const
 {
+    int n;
 #ifdef UDM_GETPOS32
     if ( wxTheApp->GetComCtl32Version() >= 580 )
     {
         // use the full 32 bit range if available
-        return ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0);
+        n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0);
     }
 #endif // UDM_GETPOS32
 
     // we're limited to 16 bit
-    return (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0));
+    n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0));
+    
+    if (n < m_min) n = m_min;
+    if (n > m_max) n = m_max;
+    
+    return n;
 }
 
 void wxSpinButton::SetValue(int val)