+// ----------------------------------------------------------------------------
+// wxSpinButton methods
+// ----------------------------------------------------------------------------
+
+void wxSpinCtrl::SetRange(int minVal, int maxVal)
+{
+ wxSpinButton::SetRange(minVal, maxVal);
+
+ // this control is used for numeric entry so restrict the input to numeric
+ // keys only -- but only if we don't need to be able to enter "-" in it as
+ // otherwise this would become impossible
+ const DWORD styleOld = ::GetWindowLong(GetBuddyHwnd(), GWL_STYLE);
+ DWORD styleNew;
+ if ( minVal < 0 )
+ styleNew = styleOld & ~ES_NUMBER;
+ else
+ styleNew = styleOld | ES_NUMBER;
+
+ if ( styleNew != styleOld )
+ ::SetWindowLong(GetBuddyHwnd(), GWL_STYLE, styleNew);
+}
+