Send EVT_SPIN_UP/DOWN events also when wxSpinButton value wraps around (wxOSX)
EVT_SPIN events should be sent at every value change, not only if it's changed by +/- 1. See #17957.
This commit is contained in:
parent
3d5e84b229
commit
a9843a7492
@ -78,11 +78,13 @@ public:
|
||||
|
||||
@beginEventEmissionTable{wxSpinEvent}
|
||||
@event{EVT_SPIN(id, func)}
|
||||
Generated whenever an arrow is pressed.
|
||||
Generated whenever pressing an arrow changed the spin button value.
|
||||
@event{EVT_SPIN_UP(id, func)}
|
||||
Generated when left/up arrow is pressed.
|
||||
Generated whenever pressing left/up arrow changed the spin button
|
||||
value.
|
||||
@event{EVT_SPIN_DOWN(id, func)}
|
||||
Generated when right/down arrow is pressed.
|
||||
Generated whenever pressing right/down arrow changed the spin
|
||||
button value.
|
||||
@endEventTable
|
||||
|
||||
Note that if you handle both SPIN and UP or DOWN events, you will be notified
|
||||
|
@ -96,6 +96,10 @@ void wxSpinButton::TriggerScrollEvent(wxEventType scrollEvent)
|
||||
{
|
||||
inc = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG( "Unexpected event" );
|
||||
}
|
||||
|
||||
// trigger scroll events
|
||||
|
||||
@ -119,32 +123,23 @@ void wxSpinButton::TriggerScrollEvent(wxEventType scrollEvent)
|
||||
newValue = m_max;
|
||||
}
|
||||
|
||||
if ( newValue - oldValue == -1 )
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
else if ( newValue - oldValue == 1 )
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
else
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
|
||||
// Do not send an event if the value has not actually changed
|
||||
// (Also works for wxSpinCtrl)
|
||||
if ( newValue == oldValue )
|
||||
return;
|
||||
|
||||
if ( scrollEvent != wxEVT_SCROLL_THUMBTRACK )
|
||||
{
|
||||
wxSpinEvent event( scrollEvent, m_windowId );
|
||||
wxSpinEvent event( scrollEvent, m_windowId );
|
||||
|
||||
event.SetPosition( newValue );
|
||||
event.SetEventObject( this );
|
||||
if ((HandleWindowEvent( event )) && !event.IsAllowed())
|
||||
newValue = oldValue;
|
||||
}
|
||||
event.SetPosition( newValue );
|
||||
event.SetEventObject( this );
|
||||
if ((HandleWindowEvent( event )) && !event.IsAllowed())
|
||||
newValue = oldValue;
|
||||
|
||||
GetPeer()->SetValue( newValue );
|
||||
SetValue( newValue );
|
||||
|
||||
// always send a thumbtrack event
|
||||
SendThumbTrackEvent() ;
|
||||
// send a thumbtrack event if EVT_SPIN_UP/DOWN wasn't vetoed
|
||||
if ( newValue != oldValue )
|
||||
SendThumbTrackEvent() ;
|
||||
}
|
||||
|
||||
#endif // wxUSE_SPINBTN
|
||||
|
Loading…
Reference in New Issue
Block a user