Always update the value of generic spin control when leaving it.
We could be left with an invalid value in the control when leaving it. E.g. in the widgets sample whose double spin control has range from 0 to 10, 123 could be entered in it and was not replaced by 10 when the control lost focus. This happened because the code didn't bother to update the text control if its contents already corresponded to the internally stored value -- but this was wrong as it could have a different representation. Just always update the text unconditionally when synchronizing it with the internal value. See #12004. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fbf3385651
commit
5afb019a0c
@ -419,10 +419,10 @@ void wxSpinCtrlGenericBase::SyncSpinToText()
|
||||
else if (textValue < m_min)
|
||||
textValue = m_min;
|
||||
|
||||
if (m_value != textValue)
|
||||
{
|
||||
DoSetValue(textValue);
|
||||
}
|
||||
// we must always set the value here, even if it's equal to m_value, as
|
||||
// otherwise we could be left with an out of range value when leaving
|
||||
// the text control and the current value is already m_max for example
|
||||
DoSetValue(textValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user