If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
int row = 2;
int col = 4;
wxPanel **cellsArray = new wxPanel*[row];
for(int i = 0; i < row; i++)
{
cellsArray[i] = new wxPanel[col];
}
wxGridSizer *gridM = new wxGridSizer(2,4,0,0);
But,
adding wxPanel as an element of cellsArray did not work.
///////////////////////////////////////////////////////////
int row = 2;
int col = 4;
wxGridSizer *gridM = new wxGridSizer(row,col,0,0);
// 2d array of panels
wxPanel **cellsArray = new wxPanel*[row]; // allocate rows
for(int i = 0; i < row; i++)
{
cellsArray[i] = new wxPanel[col]; // allocate columns
}
// create wxPanel(s) and store them in the array, then add them to wxGridSizer
for(int i=0 ; i < row ; i++)
for(int j=0 ; j < col ; j++)
{
wxPanel *newwxPanel = new wxPanel(panel, -1);
cellsArray[i][j] = *newwxPanel;
// add wxPanel to wxGridSizer
gridM->Add(&cellsArray[i][j]);
}
///////////////////////////////////////////////////////////
An empty wxPanel probably has a default size of (0,0). Try passing wxSize(16,16) as size. Also try setting a distinct background color, so you see where it is