Objective Grid: Rows not resizing correctly

Article ID: 486
Last updated: 25 Apr, 2018
Article ID: 486
Last updated: 25 Apr, 2018
Revision: 3
Views: 2038
Posted: 12 Jan, 2001
by Meltreger B.
Updated: 25 Apr, 2018
by Meltreger B.

Problem

 


I have set EnableTrackRowHeight(GX_TRACK_ALL), but some rows are not getting resized at all. What is wrong?

 

 


Cause

 


 

 


Action

 


p>EnableTrackRowHeight(GX_TRACK_ALL); forces the grid to call SetDefaultRowHeight() whenever the user is resizing a row.

SetDefaultRowHeight() changes the default height but that doesn't affect any cells where you have stored an individual row height with SetRowHeight().

So, what you can do is change the behavior of OnEndTracking() (which calls SetDefaultRowHeight() ) and force it to remove all individual row heights.

In the b override you can empty all previous row heights with:

GetParam()->m_RowHeights.RemoveAll();
GetParam()->m_ColWidths.RemoveAll();

You can save and restore the height of the header rows with:

nHeight = GetParam()->m_RowHeights[0];

and after emptying assign them back with:

GetParam()->m_RowHeights[0] = nHeight;

Example:

void CDevGrid::OnEndTracking(ROWCOL nRow, ROWCOL nCol, int nTrackingMode, CSize& size)
{
CGXGridParam *pParam = GetParam();
LockUpdate(TRUE);
CGXGridWnd::OnEndTracking(nRow, nCol, nTrackingMode, size);

if (nTrackingMode == GX_TRACKWIDTH)
{

pParam->m_ColWidths.RemoveAll();
}
else
{
LONG nHeight = pParam->m_RowHeights[0];
pParam->m_RowHeights.RemoveAll();
pParam->m_RowHeights[0] = nHeight;
}

LockUpdate(FALSE);
Redraw();

return;

}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 486
Last updated: 25 Apr, 2018
Revision: 3
Views: 2038
Posted: 12 Jan, 2001 by Meltreger B.
Updated: 25 Apr, 2018 by Meltreger B.

Others in this category