I think adding columns to an existing grid adds only the column and not the cells. It's probably a good thing if yu have merged cells anywhere. So basically if the row count isn't equal to the reported grid column count check and add cells to it.
CBCGPGridRow* pRow = m_pGridCtrl->GetRow(iRow); if(pRow!=NULL) // For some reason adding columns to an existing grid only adds them to the header row? {// (it appears adding a new column to an existing grid doesn't create the cells) while(pRow->GetItemCount() != m_pGridCtrl->GetColumnCount()) { for(int iFillRow = 0; iFillRow<m_pGridCtrl->GetColumnCount(); iFillRow++) { if(!pRow->GetItem(iFillRow)) { CBCGPGridItem * pCell = m_pGridCtrl->CreateItem(iRow,iFillRow); ASSERT(pCell); pRow->AddItem(pCell); } } } }
|