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/branches/WX_3_0_BRANCH@78117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-11-11 00:58:52 +00:00
parent a25c714163
commit 58d415807b
2 changed files with 11 additions and 13 deletions

View File

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

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