Objective Grid: Forcing the last column to fill remainder of the grid window

Article ID: 690
Last updated: 11 Jun, 2018
Article ID: 690
Last updated: 11 Jun, 2018
Revision: 3
Views: 1624
Posted: 23 Jan, 2001
by Meltreger B.
Updated: 11 Jun, 2018
by Meltreger B.

Problem


How can I make the last column fill the rest of the window's area? In other words, I don't want an empty gray area to appear after the last column.


Cause



Action


You should override GetColWidth() as follows:

int CDaoQueryView::GetColWidth(ROWCOL nCol)
{
int nWidth = CGXGridCore::GetColWidth(nCol);

// Make the last column fill the rest of
// the window so that no empty space is
// visible.
if (!IsPrinting() && nCol == GetColCount())
{

CRect rect = GetGridRect();
nCol = GetClientCol(nCol);

if (nCol > 0)

nWidth = max(nWidth, rect.Width() - CalcSumOfClientColWidths(0, nCol-1) - 1);
}

return nWidth;

}

This could be done the same way with GetRowHeight().

This article was:   Helpful | Not helpful
Report an issue
Article ID: 690
Last updated: 11 Jun, 2018
Revision: 3
Views: 1624
Posted: 23 Jan, 2001 by Meltreger B.
Updated: 11 Jun, 2018 by Meltreger B.

Others in this category