Objective Grid: Making a covered cell span an entire row

Article ID: 539
Last updated: 16 Apr, 2018
Article ID: 539
Last updated: 16 Apr, 2018
Revision: 3
Views: 1923
Posted: 11 Jan, 2001
by Meltreger B.
Updated: 16 Apr, 2018
by Meltreger B.

Problem


In the first row, I would like a covered cell to span all columns in the row (so that I can make a big header)


Cause



Action


You could override the following two methods (e.g. if row 1 is covered):

CGXRange* C1stGridView::GetCoveredCellsRowCol(ROWCOL nRow, ROWCOL nCol, CGXRange& range)
{
	// check if this is a covered row
	if (nRow == 1 && nCol > 0)
	{
	 	range.SetCells(nRow, 1, nRow, GetColCount());
	 	return &range
	}

	// normal cell
	return CGXGridCore::GetCoveredCellsRowCol(nRow, nCol, range)
}

void C1stGridView::MergeCoveredCells(CGXRange& area)
{
	 // check if area includes a covered row
	// (if you have several rows, you might loop
	// through the covered rows and test if one
	// of the covered rows is in the area)
	if (area.top <= 1 && area.bottom>= 1)
	{
	 	area.left = 1;
	 	area.right = GetColCount();
	}

	CGXGridCore::MergeCoveredCells(area);
}

This will also take care if you later add columns to the grid.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 539
Last updated: 16 Apr, 2018
Revision: 3
Views: 1923
Posted: 11 Jan, 2001 by Meltreger B.
Updated: 16 Apr, 2018 by Meltreger B.

Others in this category