+ // Sync the textctrl since the user expects that the button will modify
+ // what they see in the textctrl.
+ SyncSpinToText();
+
+ int spin_value = event.GetPosition();
+ double step = (event.GetEventType() == wxEVT_SCROLL_LINEUP) ? 1 : -1;
+
+ // Use the spinbutton's acceleration, if any, but not if wrapping around
+ if (((spin_value >= 0) && (m_spin_value >= 0)) || ((spin_value <= 0) && (m_spin_value <= 0)))
+ step *= abs(spin_value - m_spin_value);
+
+ double value = AdjustToFitInRange(m_value + step*m_increment);
+
+ // Ignore the edges when it wraps since the up/down event may be opposite
+ // They are in GTK and Mac
+ if (abs(spin_value - m_spin_value) > SPINCTRLBUT_MAX)