How can I make wxGrid (it inherits after wxScrollerWindow -> wxWindows -> …) object size fit to parent wxPanel size?
I tried Fit method, but it doesn’t work.
OnInit method:
bool MyApp::OnInit()
{
wxFrame * win = new wxFrame(NULL, -1, _T("App"), wxPoint(300,300), wxSize(400,300), wxDEFAULT_FRAME_STYLE);
wxPanel * panel = new wxPanel(win, -1);
wxGrid * grid = new wxGrid(panel, -1, wxPoint(5,5), wxSize(300,200));
grid->SetDefaultColSize(120);
grid->SetDefaultRowSize(55);
grid->SetRowLabelSize(55);
grid->SetColLabelSize(25);
grid->CreateGrid(2,6,wxGrid::wxGridSelectCells);
grid->Fit();
win->Show();
return true;
}
MyApp inherits after wxApp.
You may want to use a sizer:
When the wxFrame is resized (as well as once it’s shown for the first time), it automatically resizes its only (direct) child window (the panel) to fit its client size. The panel’s sizer will then resize the grid.