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.
This commit is contained in:
Niels Martin Hansen 2009-07-26 23:24:21 +00:00
parent f066903d98
commit f2e8333aea
1 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,7 @@
// Includes
#include "config.h"
#include <wx/sizer.h>
#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;