diff --git a/docs/changes.txt b/docs/changes.txt
index 9940b7bff4..41c2e66288 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -497,6 +497,7 @@ All (GUI):
Added also wxEventLoopBase::IsYielding to help cure re-entrancy problems with Yield().
- Render
element contents in bold in wxHTML.
- Added wxGrid::{Set,Get}{Row,Col}Sizes() methods (Andrey Putrin).
+- Add support for wxSP_WRAP in the generic version of wxSpinCtrlDouble.
wxGTK:
diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp
index 1235d9819c..8be2e5d720 100644
--- a/src/generic/spinctlg.cpp
+++ b/src/generic/spinctlg.cpp
@@ -339,9 +339,11 @@ void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event)
double value = m_value + step*m_increment;
- // we can always reach the ends using the spinbutton
- if (value < m_min) value = m_min;
- if (value > m_max) value = m_max;
+ // Check for over/underflow wrapping around if necessary
+ if (value < m_min)
+ value = HasFlag(wxSP_WRAP) ? m_max : m_min;
+ if (value > m_max)
+ value = HasFlag(wxSP_WRAP) ? m_min : m_max;
// Ignore the edges when it wraps since the up/down event may be opposite
// They are in GTK and Mac
|