I've dealt with wxGrid a fair bit before, and have never had any problems, this time around, for some reason, the grid just isn't displaying. The sizer will happily display other types of windows/controls, but the grid just won't appear.
Relevant code bits:
wxGrid* historicLegalLengthsGrid;
historicLegalLengthsGrid = new wxGrid(RunSettingsBackground_panel, -1);
historicLegalLengthsGrid->CreateGrid(4, 4);
wxBoxSizer* HistLegalLength_sizer = new wxBoxSizer(wxVERTICAL);
HistLegalLength_sizer->Add(historicLegalLengthsGrid, 0, wxALL, 10);
Previously I had a bitmap placeholder which was displayed fine, I simply replaced it with the grid and nothing get's displayed. It text controls just fine. I've spent an hour or two comparing my code relentlessly with the project that had the grids working fine, and I can notice no difference at all.
Any help much appreciated, this is giving me a headache.
Thanks.
wxGrid woes
-
- In need of some credit
- Posts: 9
- Joined: Wed Sep 01, 2004 11:45 am
- Location: Minneapolis, MN
- Contact:
mshaw62,
I encountered the same problem sometime back. The solution for me was to explicitly set the column and row sizes before I called CreateGrid. Here's the code I used:
m_Grid = new wxGrid(dlg, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
m_Grid->SetDefaultColSize(150);
m_Grid->SetDefaultRowSize(20);
m_Grid->CreateGrid(100, 10, wxGrid::wxGridSelectRows);
Hope that helps.
John
I encountered the same problem sometime back. The solution for me was to explicitly set the column and row sizes before I called CreateGrid. Here's the code I used:
m_Grid = new wxGrid(dlg, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
m_Grid->SetDefaultColSize(150);
m_Grid->SetDefaultRowSize(20);
m_Grid->CreateGrid(100, 10, wxGrid::wxGridSelectRows);
Hope that helps.
John