apply patch 1630906 after all as with my simpler fix in the last commit the control may remain empty when it is supposed to show 0 value

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-01-11 01:48:52 +00:00
parent e816f5c736
commit b6d8301814

View File

@@ -269,16 +269,21 @@ void wxSpinCtrl::OnSetFocus(wxFocusEvent& event)
void wxSpinCtrl::NormalizeValue()
{
const int value = GetValue();
if ( value == m_oldValue )
return;
const bool changed = value == m_oldValue;
// notice that we have to call SetValue() even if the value didn't change
// because otherwise we could be left with empty buddy control when value
// is 0, see comment in SetValue()
SetValue(value);
wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
event.SetEventObject(this);
event.SetInt(value);
GetEventHandler()->ProcessEvent(event);
m_oldValue = value;
if ( changed )
{
wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
event.SetEventObject(this);
event.SetInt(value);
GetEventHandler()->ProcessEvent(event);
m_oldValue = value;
}
}
// ----------------------------------------------------------------------------