From f9637c9626dc36b42cb588864231d10118240d9c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 11 Nov 2014 01:02:08 +0000 Subject: [PATCH] Set the initial text value of wxSpinCtrlGeneric correctly. The text control was left empty if the string value was not specified, but it should use the numeric initial value instead in this case. This notably affected wxSpinCtrlDouble under non-GTK platforms. Closes #16621. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/spinctlg.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 319a5b57b5..e14aa5b4b1 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 specify 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);