Always initialize m_format in DetermineDigits()
It doesn't seem right to leave it unchanged when increment is outside of [0, 1] interval, we should still set it to something in this case. And doing this makes it unnecessary and redundant to initialize m_format in Init(), as it will be always done when DetermineDigits() is called from Create() anyhow.
This commit is contained in:
@@ -424,7 +424,6 @@ private:
|
||||
void Init()
|
||||
{
|
||||
m_digits = 0;
|
||||
m_format = wxASCII_STR("%0.0f");
|
||||
}
|
||||
|
||||
// Update m_digits and m_format to correspond to the given increment.
|
||||
|
@@ -778,8 +778,13 @@ void wxSpinCtrlDouble::DetermineDigits(double inc)
|
||||
if ( inc > 0.0 && inc < 1.0 )
|
||||
{
|
||||
m_digits = wxMin(SPINCTRLDBL_MAX_DIGITS, -static_cast<int>(floor(log10(inc))));
|
||||
m_format.Printf("%%0.%ulf", m_digits);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_digits = 0;
|
||||
}
|
||||
|
||||
m_format.Printf("%%0.%ulf", m_digits);
|
||||
}
|
||||
|
||||
#endif // wxUSE_SPINBTN
|
||||
|
Reference in New Issue
Block a user