From 01565945431705c314d4e3521f3567c1d2cafe9e Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 27 Dec 2002 14:17:55 +0000 Subject: [PATCH] Improved SetScrollbars fix using client size and max of window and virtual sizes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index efe09689d2..4da24ea311 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -340,18 +340,18 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, m_xScrollPosition = xPos; m_yScrollPosition = yPos; - wxSize sz = m_targetWindow->GetSize(); - int x = noUnitsX * pixelsPerUnitX; - int y = noUnitsY * pixelsPerUnitY; - if (x == 0) - x = sz.x; - if (y == 0) - y = sz.y; - // For better backward compatibility we set persisting limits // here not just the size. It makes SetScrollbars 'sticky' // emulating the old non-autoscroll behaviour. + wxSize sz = m_targetWindow->GetClientSize(); +#if 1 + int x = wxMax(noUnitsX * pixelsPerUnitX, sz.x); + int y = wxMax(noUnitsY * pixelsPerUnitY, sz.y); +#else + int x = noUnitsX * pixelsPerUnitX; + int y = noUnitsY * pixelsPerUnitY; +#endif m_targetWindow->SetVirtualSizeHints( x, y ); // The above should arguably be deprecated, this however we still need. -- 2.45.2