diff --git a/docs/changes.txt b/docs/changes.txt index 0a09cd51f9..f2b0cd09c1 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -590,6 +590,7 @@ wxMSW: - Fix compilation with C++Builder XE compiler (Nichka). - Fix best height of wxSlider with labels but without ticks (Artur Wieczorek). +- Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat). 3.0.2: (released 2014-10-06) diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 3da88c9404..8209a30ae4 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -210,16 +210,6 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, 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 @@ -228,12 +218,19 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, { double d; if ( DoTextToValue(value, &d) ) - { m_value = d; - m_textCtrl->ChangeValue(DoValueToText(m_value)); - } } + m_textCtrl = new wxSpinCtrlTextGeneric(this, DoValueToText(m_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(); + SetInitialSize(size); Move(pos);