Don't generate events from wxSpinCtrl::SetRange() in wxMSW.
Other ports don't send wxEVT_COMMAND_SPINCTRL_UPDATED from SetRange() even if the value changed because it was adjusted to fit into the new range and this makes sense as this change is not due to a user action, so don't send this event under wxMSW neither. Also add a unit test checking for this behaviour. Closes #14583. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -494,6 +494,14 @@ void wxSpinCtrl::SetSelection(long from, long to)
|
||||
|
||||
void wxSpinCtrl::SetRange(int minVal, int maxVal)
|
||||
{
|
||||
// Manually adjust the old value to avoid an event being sent from
|
||||
// NormalizeValue() called from inside the base class SetRange() as we're
|
||||
// not supposed to generate any events from here.
|
||||
if ( m_oldValue < minVal )
|
||||
m_oldValue = minVal;
|
||||
else if ( m_oldValue > maxVal )
|
||||
m_oldValue = maxVal;
|
||||
|
||||
wxSpinButton::SetRange(minVal, maxVal);
|
||||
|
||||
// this control is used for numeric entry so restrict the input to numeric
|
||||
|
Reference in New Issue
Block a user