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
This commit is contained in:
Vadim Zeitlin 2014-11-11 01:02:08 +00:00
parent dbd22a81e4
commit f9637c9626

View File

@ -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);