fix lack of spin control update event when control lost focus (replaces patch 1630906, corrects bug introduced in rev 1.66)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -88,6 +88,13 @@ Major new features in 2.8 release
|
|||||||
wxSearchCtrl, wxAboutBox, wxTreebook, tar streams.
|
wxSearchCtrl, wxAboutBox, wxTreebook, tar streams.
|
||||||
|
|
||||||
|
|
||||||
|
2.8.2
|
||||||
|
-----
|
||||||
|
|
||||||
|
wxMSW
|
||||||
|
|
||||||
|
- Fix lack of spin control update event when control lost focus
|
||||||
|
|
||||||
2.8.1
|
2.8.1
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@@ -111,7 +111,6 @@ wxCONSTRUCTOR_6( wxSpinCtrl , wxWindow* , Parent , wxWindowID , Id , wxString ,
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//pmg EVT_KILL_FOCUS
|
|
||||||
BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
|
BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
|
||||||
EVT_CHAR(wxSpinCtrl::OnChar)
|
EVT_CHAR(wxSpinCtrl::OnChar)
|
||||||
|
|
||||||
@@ -269,16 +268,17 @@ void wxSpinCtrl::OnSetFocus(wxFocusEvent& event)
|
|||||||
|
|
||||||
void wxSpinCtrl::NormalizeValue()
|
void wxSpinCtrl::NormalizeValue()
|
||||||
{
|
{
|
||||||
int value = GetValue();
|
const int value = GetValue();
|
||||||
SetValue( value );
|
if ( value == m_oldValue )
|
||||||
if (value != m_oldValue)
|
return;
|
||||||
{
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, GetId() );
|
SetValue(value);
|
||||||
event.SetEventObject( this );
|
|
||||||
event.SetInt( value );
|
wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, GetId());
|
||||||
GetEventHandler()->ProcessEvent( event );
|
event.SetEventObject(this);
|
||||||
m_oldValue = value;
|
event.SetInt(value);
|
||||||
}
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
m_oldValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -368,7 +368,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetRange(min, max);
|
SetRange(min, max);
|
||||||
SetValue(initial);
|
SetValue(initial);
|
||||||
|
|
||||||
m_oldValue = initial;
|
m_oldValue = initial;
|
||||||
|
|
||||||
// subclass the text ctrl to be able to intercept some events
|
// subclass the text ctrl to be able to intercept some events
|
||||||
@@ -449,7 +449,7 @@ void wxSpinCtrl::SetValue(int val)
|
|||||||
// current value in the control, so do it manually
|
// current value in the control, so do it manually
|
||||||
::SetWindowText(GetBuddyHwnd(), wxString::Format(_T("%d"), val));
|
::SetWindowText(GetBuddyHwnd(), wxString::Format(_T("%d"), val));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_oldValue = GetValue();
|
m_oldValue = GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,7 +550,7 @@ void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
|
|||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
int value = eventSpin.GetPosition();
|
int value = eventSpin.GetPosition();
|
||||||
event.SetInt( value );
|
event.SetInt( value );
|
||||||
|
|
||||||
if (value != m_oldValue)
|
if (value != m_oldValue)
|
||||||
(void)GetEventHandler()->ProcessEvent(event);
|
(void)GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
@@ -558,7 +558,7 @@ void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin)
|
|||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_oldValue = value;
|
m_oldValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user