CGXGridCore::CopyRangeList
BOOL CopyRangeList(CGXRangeList& list, BOOL bEdit);
list
A reference to the destination list.
bEdit
Specifies if the current cell should copied when no ranges are selected.
Return Value
TRUE if the destination list is not empty; FALSE if it is empty.
Remarks
Copies the selected ranges list to list. If you pass TRUE for bEdit and there are no cells selected, the method will copy the current cell’s coordinates.
Example
This example illustrates the usage of CopyRangeList and iterating through the range list.
void CGridSampleView::SetStyle(const CGXStyle* pStyle, GXModifyType mt)
{
// if there are no cells selected,
// copy the current cell's coordinates
CGXRangeList selList;
if (!CopyRangeList(selList, TRUE))
return;
CGXLongOperation theOp;
BeginTrans(GXGetAppData( )->strmCellFormatting);
// loop through selected cells
POSITION pos = selList.GetHeadPosition( );
while (pos)
{
CGXRange rect = selList.GetNext(pos);
// rect.ExpandRange(1, 1, GetRowCount( ), GetColCount( ));
// SetStyleRange returns FALSE if operation failed.
if (!SetStyleRange(rect, pStyle, mt, rect.IsCells( ) ? 0: -1)
|| theOp.DoMessages(bAbort) && bAbort)
{
Rollback( );
return;
}
}
CommitTrans( );
}
See Also
CGXRangeListCGXRangeCGXGridCore::GetCurrentCell