- SetBackgroundColour(*wxRED);
- m_text = new wxSpinCtrlText(this, value);
- m_btn = new wxSpinCtrlButton(this, style);
+ m_value = initial;
+ m_min = min;
+ m_max = max;
+ m_increment = increment;
+
+ m_textCtrl = new wxSpinCtrlTextGeneric(this, value, style);
+ m_spinButton = new wxSpinCtrlButtonGeneric(this, style);
+#if wxUSE_TOOLTIPS
+ m_textCtrl->SetToolTip(GetToolTipText());
+ m_spinButton->SetToolTip(GetToolTipText());
+#endif // wxUSE_TOOLTIPS
+
+ m_spin_value = m_spinButton->GetValue();
+
+ // the string value overrides the numeric one (for backwards compatibility
+ // reasons and also because it is simpler to satisfy the string value which
+ // comes much sooner in the list of arguments and leave the initial
+ // parameter unspecified)
+ if ( !value.empty() )
+ {
+ double d;
+ if ( value.ToDouble(&d) )
+ {
+ m_value = d;
+ m_textCtrl->SetValue(wxString::Format(m_format, m_value));
+ }
+ }