- ::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
- (LPARAM) MAKELONG((short)maxVal, (short)minVal));
+
+#ifdef UDM_SETRANGE32
+ if ( wxApp::GetComCtl32Version() >= 471 )
+ {
+ // use the full 32 bit range if available
+ ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal);
+ }
+ else // we're limited to 16 bit
+#endif // UDM_SETRANGE32
+ {
+ ::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
+ (LPARAM) MAKELONG((short)maxVal, (short)minVal));
+ }
+
+ // the current value might be out of the new range, force it to be in it
+ NormalizeValue();
+
+ // if range was valid but becomes degenerated (min == max) now or vice
+ // versa then the spin buttons are automatically disabled/enabled back
+ // but don't update themselves for some reason, so do it manually
+ if ( hadRange != (m_min < m_max) )
+ {
+ // update the visual state of the button
+ Refresh();
+ }