So I created a small frame-based app and set a grid (10 cols x 12 rows) on it in hopes of seeing alternate colors for the grid rows. When I saw nothing for that, I opened the griddemo.cpp sample and looked at the SetRowAttr(). I copied it over to my file and changed it a little:
Code: Select all
wxGridCellAttr *attr;
attr = new wxGridCellAttr;
attr->SetTextColour(*wxBLUE);
Grid1->SetColAttr(5, attr);
attr = new wxGridCellAttr;
attr->SetBackgroundColour(wxColour( 255, 232, 255, wxALPHA_TRANSPARENT));
for(int i{}; i +1 <= 10; ++i){
if(i % 2){
Grid1->SetRowAttr(i, attr);
}
}
Thanks.
This is on Win X using Code::Blocks.
UPDATE: For some reason, the problem seems to occur only when Grid1->SetRowAttr(i, attr); is called repetitively. I changed the above code to call it only once and all was fine. However, even calling it twice brought back the status codes again. I'll get it to point where data is being put in the grid and see what happens when I color alternate lines on it.