virtual BOOL StoreStyleRowCol(ROWCOL nRow, ROWCOL nCol, const CGXStyle* pStyle, GXModifyType mt = gxOverride, int nType = 0);?
nRow
Specifies the row id.
nCol
Specifies the column id.
pStyle
Points to the style to be applied on the cell. It is NULL if the cell should be removed.
mt
Modify-Type: gxOverride, gxApplyNew, gxCopy, gxExclude or gxRemove (see CGXStyle::ChangeStyle).
nType
Specifies the type of information to be retrieved:
value greater than 1 can be used by yourself.
TRUE if the style could be stored. It is FALSE if the style could not be stored.
Overridable method which stores the pure style for the specified cell into the associated data-object. The base-class version of this method applies the style to the data-object (CGXData::GetStyleRowCol) maintained by the parameter-object.
Override this method if you want to dynamically bind the grid to a C Library for database handling. See the example. If you do maintain the data in one of your derived classes and you want to support inserting and removing rows, you should also override StoreRemoveRows and StoreInsertRows.
Note that nType is -1 to store the style as base style for the whole row, column or table. If nType is -1, either nRow or nCol is zero.
If nType is 0, the style of the cell displayed in the grid is stored. If the user changes a cell’s data, the grid-component will call SetStyleRange with nType = 0.
The grid-component never calls SetStyleRange and StoreStyleRowCol with a value greater than 0. However, if you explicitly pass an nType value to SetStyleRange, this value is passed to StoreStyleRowCol. See GetStyleRowCol for information on using your own nType-values greater than 0.
If pStyle is NULL and mt is gxRemove the style-objects will be removed.
If pStyle is NULL and mt is not gxRemove or if pStyle is not NULL and mt is gxRemove, the method asserts.
This example illustrates how you can store the value of a cell to a dbase file.
BOOL CDBaseBrowserView::StoreStyleRowCol(ROWCOL nRow, ROWCOL nCol, const CGXStyle* pStyle, GXModifyType mt, int nType)
{
if (mt == gxRemove) // not supported
return FALSE;
// Note: I do not distinguish between gxApplyNew, gxCopy and gxOverride
ASSERT(nRow <= LONG_MAX);
long nRecord = (long) nRow;
if (nType == -1)
{
// here you could store the style for a complete row, column or table
return FALSE;
}
else if (nRow == 0 && nCol == 0)
{
// style for the top-left button
return FALSE;
}
else if (nRow == 0)
{
// Column headers
return FALSE;
}
else if (GetDocument( )->m_dbfile.Seek(nRecord-1))
{
if (nCol == 0)
{
// Row headers
return FALSE;
}
else
{
// Cell value
if (pStyle->GetIncludeValue( ))
GetDocument( )->m_dbfile.SetValue(GetFieldId(nCol), pStyle->GetValue( ));
SetModifiedFlag( );
return TRUE;
}
}
// unreferenced:
mt;
return FALSE;
}
CGXGridCore::GetStyleRowCol CGXStyle::ChangeStyle
Class Overview | Class Members