CGXGridCore::GetSelectedCols

ROWCOL GetSelectedCols(CRowColArray& awCols, BOOL bRangeColsOnly = FALSE, BOOL bCanUseCurrentCell = TRUE);

BOOL GetSelectedCols(CRowColArray& awLeft, CRowColArray& awRight, BOOL bRangeColsOnly = FALSE, BOOL bCanUseCurrentCell = TRUE);

awCols

Reference to an array of ROWCOL attributes to store all selected columns.

bRangeColsOnly

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

bCanUseCurrentCell

TRUE if the column of the current cell can be returned when there are no other cells selected; FALSE if current cell shall be discarded.

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.

Return Value

The first version of the method returns the number of selected columns. The second version returns TRUE if the method could return any columns; FALSE if not.

Remarks

This method loops through the selected ranges and stores the column-ids in the given array.

The first version of this method stores all columns in awCols.

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

Example

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

CRowColArray awCols;
ROWCOL nCount = GetSelectedCols(awCols);
for (ROWCOL n = 0; n < nCount; n++)
{
   TRACE("Column %ld is selected\n", awCols[n]);
}

The next example shows how you can use the second version of this method:

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

CGXGridCore

 Class Overview |  Class Members