virtual BOOL SetColCount(ROWCOL nCols, UINT flags = GX_UPDATENOW);
nCols
Specifies the new number of columns.
flags
Specifies the update technique. This parameter is passed either to InsertCols or RemoveCols.
TRUE if the command was successful; FALSE if it failed.
Inserts or removes columns by calling either InsertCols or RemoveCols.
You can override this method and call StoreColCount to change the data and update the display with UpdateChangedColCount (both methods are undocumented, but will remain in the library). In earlier versions, this technique was used to change the number of columns. A disadvantage of this technique was missing support for undo and redo and code redundancy. For this reason, the method passes the responsibility to InsertCols or RemoveCols.
SetColCount must not be called before the grid has been initialized with OnGridInitialUpdate or Initialize.
The first example illustrates how to set the number rows and columns in a grid control.
CGXGridWnd* pGridWnd = new CGXGridWnd( );
VERIFY(pGridWnd->Create(WS_VSCROLL | WS_HSCROLL, rect, this, ID_GRID));
pGridWnd->Initialize( );
pGridWnd->SetRowCount(32);
pGridWnd->SetColCount(16);
The second example illustrates how to set the number rows and columns in a grid view.
void CGridSampleView::OnInitialUpdate( )
{
...
CGXGridView::OnInitialUpdate( );
SetRowCount(512);
SetColCount(28);
...
}
CGXGridCore::InsertCols CGXGridCore::RemoveCols CGXGridCore::ClearCells
Class Overview | Class Members