Don't decrease the number of digits implicitly
wxSpinCtrlDouble::SetIncrement() should increase the number of digits if necessary because not doing it would be inconsistent with the initial determination of the number of digits in the ctor and would actually lose the digits displayed, but it seems unnecessary to decrease the number of digits and it might be surprising, so don't do it. Add a test for this behaviour and document it.
This commit is contained in:
@@ -384,7 +384,7 @@ public:
|
||||
double inc = 1,
|
||||
const wxString& name = wxT("wxSpinCtrlDouble"))
|
||||
{
|
||||
DetermineDigits(inc);
|
||||
DoSetDigits(DetermineDigits(inc));
|
||||
return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size,
|
||||
style, min, max, initial,
|
||||
inc, name);
|
||||
@@ -426,8 +426,9 @@ private:
|
||||
DoSetDigits(0);
|
||||
}
|
||||
|
||||
// Update m_digits and m_format to correspond to the given increment.
|
||||
void DetermineDigits(double inc);
|
||||
// Return the number of digits required to show the numbers using the
|
||||
// specified increment without loss of precision.
|
||||
static unsigned DetermineDigits(double inc);
|
||||
|
||||
// Set the number of digits and the format unconditionally.
|
||||
void DoSetDigits(unsigned digits);
|
||||
|
Reference in New Issue
Block a user