From f2e8333aea0a5b78a4730871aa0d6c46ff2061be Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 26 Jul 2009 23:24:21 +0000 Subject: [PATCH] Fix #953, somewhat hackish: The grid never sized down because the scroll bar was a child window of it, and when a window has child windows, the bottom and rightmost coordinates of those together determine the minimum size of the containing window. This behaviour changes if those child windows are managed by a sizer. By putting the scroll bar into a sizer the problem goes away. I think a better solution would be to change to use wxWindow::SetScrollbar() but that's a larger operation. Originally committed to SVN as r3295. --- aegisub/src/base_grid.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index 08889c32f..4692342bc 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -38,6 +38,7 @@ // Includes #include "config.h" +#include #include "base_grid.h" #include "utils.h" #include "ass_file.h" @@ -70,6 +71,12 @@ BaseGrid::BaseGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wx scrollBar = new wxScrollBar(this,GRID_SCROLLBAR,wxDefaultPosition,wxDefaultSize,wxSB_VERTICAL); scrollBar->SetScrollbar(0,10,100,10); + wxBoxSizer *scrollbarpositioner = new wxBoxSizer(wxHORIZONTAL); + scrollbarpositioner->AddStretchSpacer(); + scrollbarpositioner->Add(scrollBar, 0, wxEXPAND, 0); + + SetSizerAndFit(scrollbarpositioner); + // Set style UpdateStyle(); } @@ -769,6 +776,8 @@ void BaseGrid::AdjustScrollbar() { ///////////////////// // Set column widths void BaseGrid::SetColumnWidths() { + if (!IsShownOnScreen()) return; + // Width/height int w = 0; int h = 0;