Don't allow wxSpinCtrl range to include negative values if base != 10 (wxOSX)
For the sake of consistency with another ports only unsigned hexadecimal numbers should be supported. To do so we need to prevent: - Setting a range including negative values if base == 16. - Setting base != 10 if current range includes negative values. Closes #18805.
This commit is contained in:
@@ -585,6 +585,12 @@ double wxSpinCtrlGenericBase::AdjustToFitInRange(double value) const
|
||||
|
||||
void wxSpinCtrlGenericBase::DoSetRange(double min, double max)
|
||||
{
|
||||
// Negative values in the range are allowed only if base == 10
|
||||
if ( !wxSpinCtrlImpl::IsBaseCompatibleWithRange(min, max, GetBase()) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( min != m_min || max != m_max )
|
||||
m_textCtrl->InvalidateBestSize();
|
||||
|
||||
@@ -632,6 +638,10 @@ bool wxSpinCtrl::SetBase(int base)
|
||||
if ( base == m_base )
|
||||
return true;
|
||||
|
||||
// For negative values in the range only base == 10 is allowed
|
||||
if ( !wxSpinCtrlImpl::IsBaseCompatibleWithRange(m_min, m_max, base) )
|
||||
return false;
|
||||
|
||||
// Update the current control contents to show in the new base: be careful
|
||||
// to call DoTextToValue() before changing the base...
|
||||
double val;
|
||||
|
||||
Reference in New Issue
Block a user