<< Return to Main Index

< Return to Class Index

CGXWrappedGrid::SetWGColCount

virtual BOOL SetWGColCount(ROWCOL nCols, UINT flags = GX_UPDATENOW);

nCols

Specifies the number of logical columns

flags

Specifies the update technique. This value is passed either to InsertWGCols or RemoveWGCols.

Return Value

TRUE if the command was successful; FALSE if it failed.

Remarks

Overridable method that inserts or removes rows by calling InsertWGCols or RemoveWGCols.

SetWGColCount must not be called before the grid has been initialized with OnGridInitialUpdate or Initialize.

Example

This example illustrates how to set the number of logical rows and columns in the grid and how to set the indent widths and row breaks.

void CWrappedGridView::OnInitialUpdate()
{
   ...

   CGXWrappedGrid<CGXGridView>::OnInitialUpdate();

   SetWGColCount(10);
   SetWGRowCount(10);

   // Set the width of each field in pixels
   int aColWidth[10];
   aColWidth[0] = 50;
   aColWidth[1] = 50;
   aColWidth[2] = 60;
   aColWidth[3] = 65;
   aColWidth[4] = 60;
   SetWGColWidth(1, 5, 0, aColWidth);   // The rest of the
                                          // columns will have
                                          // the default width

   // Set the row breaks...
   CWordArray aIndentWidths;
   aIndentWidths.SetSize(3);      // Indent width in no. of pixels
   aIndentWidths.SetAt(0, 0);
   aIndentWidths.SetAt(1, 20);
   aIndentWidths.SetAt(2, 25);

   CDWordArray aRowBreaks;
   aRowBreaks.SetSize(3);      // Each WrappedGrid row wraps
                                 // between 3 grid rows.
   aRowBreaks.SetAt(0, 4);      // Break after WrappedGrid col
                                 // 4 (0 based)...
   aRowBreaks.SetAt(1, 7);      // Break after WrappedGrid col
                                 // 7 (0 based)...
   aRowBreaks.SetAt(2, 9);      // Always break after the last
                                 // WrappedGrid col...
   SetWGRowBreaks(aRowBreaks, &aIndentWidths);

   ...

}

See Also

CGXWrappedGrid::SetWGRowCount CGXWrappedGrid::InsertWGCols CGXWrappedGrid::RemoveWGCols

CGXWrappedGrid

Class Overview | Class Members