From: Vadim Zeitlin Date: Thu, 17 Mar 2005 22:27:28 +0000 (+0000) Subject: don't set virtual size of the window to (0, 0) if scrollbars are removed from it X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f18f464cbad4254cc704ee2d3a873b069e710926 don't set virtual size of the window to (0, 0) if scrollbars are removed from it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 4578f66193..7add087eda 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -365,7 +365,11 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, // The above should arguably be deprecated, this however we still need. - m_targetWindow->SetVirtualSize( w, h ); + // take care not to set 0 virtual size, 0 means that we don't have any + // scrollbars and hence we should use the real size instead of the virtual + // one which is indicated by using wxDefaultCoord + m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord, + h ? h : wxDefaultCoord); if (do_refresh && !noRefresh) m_targetWindow->Refresh(true, GetScrollRect()); diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 484aa18183..5a31109d61 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -407,7 +407,10 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY, // a sizer might override this manual scrollbar setting in old code. // m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY ); - m_targetWindow->SetVirtualSize( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY ); + int w = noUnitsX * pixelsPerUnitX; + int h = noUnitsY * pixelsPerUnitY; + m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord, + h ? h : wxDefaultCoord); if (!noRefresh) { diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index 484aa18183..5a31109d61 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -407,7 +407,10 @@ void wxScrolledWindow::SetScrollbars( int pixelsPerUnitX, int pixelsPerUnitY, // a sizer might override this manual scrollbar setting in old code. // m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY ); - m_targetWindow->SetVirtualSize( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY ); + int w = noUnitsX * pixelsPerUnitX; + int h = noUnitsY * pixelsPerUnitY; + m_targetWindow->SetVirtualSize( w ? w : wxDefaultCoord, + h ? h : wxDefaultCoord); if (!noRefresh) {