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:
parent
f066903d98
commit
f2e8333aea
1 changed files with 9 additions and 0 deletions
|
@ -38,6 +38,7 @@
|
||||||
// Includes
|
// Includes
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <wx/sizer.h>
|
||||||
#include "base_grid.h"
|
#include "base_grid.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "ass_file.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 = new wxScrollBar(this,GRID_SCROLLBAR,wxDefaultPosition,wxDefaultSize,wxSB_VERTICAL);
|
||||||
scrollBar->SetScrollbar(0,10,100,10);
|
scrollBar->SetScrollbar(0,10,100,10);
|
||||||
|
|
||||||
|
wxBoxSizer *scrollbarpositioner = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
scrollbarpositioner->AddStretchSpacer();
|
||||||
|
scrollbarpositioner->Add(scrollBar, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
SetSizerAndFit(scrollbarpositioner);
|
||||||
|
|
||||||
// Set style
|
// Set style
|
||||||
UpdateStyle();
|
UpdateStyle();
|
||||||
}
|
}
|
||||||
|
@ -769,6 +776,8 @@ void BaseGrid::AdjustScrollbar() {
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// Set column widths
|
// Set column widths
|
||||||
void BaseGrid::SetColumnWidths() {
|
void BaseGrid::SetColumnWidths() {
|
||||||
|
if (!IsShownOnScreen()) return;
|
||||||
|
|
||||||
// Width/height
|
// Width/height
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
|
|
Loading…
Reference in a new issue