From d0604192a55216dd4d7494541ab32cfe4afd1ad0 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 23 Dec 2002 23:42:13 +0000 Subject: [PATCH] Don't pass zero width or height to SetVirtualSize or layout is messed up. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 8c40ecb853..efe09689d2 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -340,15 +340,23 @@ 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. - m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY ); + m_targetWindow->SetVirtualSizeHints( x, y ); // The above should arguably be deprecated, this however we still need. - m_targetWindow->SetVirtualSize( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY ); + m_targetWindow->SetVirtualSize( x, y ); if (do_refresh && !noRefresh) m_targetWindow->Refresh(TRUE, GetRect()); -- 2.45.2