virtual BOOL StoreColWidth(ROWCOL nCol, int nWidth = 0);?
nCol
Specifies the column id. It is 0 for the row header.
nWidth
Specifies the width in pixels.
TRUE if the value could be stored; it is FALSE if the value could not be stored.
Overridable method which converts the value of the column-width for the specified column to a logical value and stores it into the column-widths-map of the parameter-object.
You can override this method if you want to maintain the data in your own classes. The library accesses the data through GetColWidth.
If you do override this method, you should consider converting the pixel value to a logical value by calling Width_DPtoLP (see example), and you should also think of inserting and removing columns, if you want to support moving.
GX_NXAVGWIDTH is a constant which defines the average logical width of a character.
This example illustrates how to override StoreColWidth and maintain the column-widths in your own classes. The method stores the average number of chars fitting into the column.
BOOL CDBaseBrowserView::StoreColWidth(ROWCOL nCol, int nWidth)
{
if (nCol > 0)
{
// GX_NXAVGWIDTH is average logical width of a char
// Width_DPtoLP converts from pixel to logical value
GetField(nCol)->width = (short) (Width_DPtoLP(nWidth) / GX_NXAVGWIDTH);
SetModifiedFlag( );
return TRUE;
}
return CGXGridView::StoreColWidth(nCol, nWidth);
}
Class Overview | Class Members