merged in fix for GetValue() from the 2.2 branch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-12-14 15:48:30 +00:00
parent beed393c67
commit ef7a25a73e
2 changed files with 12 additions and 6 deletions

View File

@@ -157,7 +157,10 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
int wxSlider::GetValue() const int wxSlider::GetValue() const
{ {
return (int)(m_adjust->value+0.5); // we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and
// -0.9 is rounded to -1
double val = m_adjust->value;
return (int)(val >= 0 ? val - 0.5 : val + 0.5);
} }
void wxSlider::SetValue( int value ) void wxSlider::SetValue( int value )

View File

@@ -157,7 +157,10 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
int wxSlider::GetValue() const int wxSlider::GetValue() const
{ {
return (int)(m_adjust->value+0.5); // we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and
// -0.9 is rounded to -1
double val = m_adjust->value;
return (int)(val >= 0 ? val - 0.5 : val + 0.5);
} }
void wxSlider::SetValue( int value ) void wxSlider::SetValue( int value )