<< Return to Main Index

< Return to Class Index

CGXRangeList::GetColArray

BOOL GetColArray(ROWCOL nColCount, CRowColArray& awLeft, CRowColArray& awRight, BOOL bFixed = FALSE);

nColCount

You should pass the column count in the grid.

awLeft

Reference to an array of ROWCOL attributes to store the first column of a range of columns.

awRight

Reference to an array of ROWCOL attributes to store the last column of a range of columns.

bFixed

TRUE if only completely selected columns shall be returned; FALSE if columns shall also be returned in which only some cells have been selected.

Return Value

TRUE if the method could return any columns; FALSE if not.

Remarks

This method loops through each range in the list and returns an array of columns. If there are intersections, ranges will be combined. The array is sorted by value.

The method stores ranges of columns in awLeft and awRight, where awLeft[n] contains the first column and awRight[n] contains the last column of the range at position n.

Example

This example shows you how you can determine selected columns and loop through them:

CRangeList rangeList;
CRowColArray awLeft, awRight;
if (rangeList.GetColArray(GetColCount(), awLeft, awRight))
{
   for (ROWCOL n = 0; n < awLeft.GetCoun( ); n++)
   {
      TRACE("Column %ld to %ld is selected\n", awLeft[n], awRight[n]);
   }
}

See Also

CGXRangeList::GetRowArray

CGXRangeList

Class Overview | Class Members