CGXControl::StoreStyle

virtual BOOL StoreStyle(ROWCOL nRow, ROWCOL nCol, const CGXStyle* pStyle, GXModifyType mt, int nType, const CGXStyle* pOldStyle);

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:

  • 0 specifies that the style for the visible cell is stored.

A value greater 0 can be used by you.

pOldStyle

An optional pointer to an existing style object for the cell. SetControlText can use this object to determine information about the cell (e.g., input mask or read-only state) without having to gather the style information from the grid.

Return Value

TRUE if the style could be stored. It is FALSE if no style information was stored in the grid.

Remarks

StoreStyle will be called from SetStyleRange and allows you to adjust the cell’s style information before it is stored in the grid by calling StoreStyleRowCol.

The default implementation of StoreStyle will check if the cell is read-only and, if this is the case, return without changing the cell. If the cell is writable, it will call StoreStyleRowCol.

The CGXRichEditCtrl class has overridden this method and converts font attributes like “Bold” or “Italic” into RTF statements in the style value (RTF String) before it calls StoreStyleRowCol. If the style only includes formatting commands which can be converted into RTF statements, and StoreStyle is called for the active current cell, no style information will be stored in the grid. Only the selected text in the RichEdit control will be formatted with the new attributes. You can check this out in the RTFGrid sample when you have a RichEdit cell and press a “Bold” toolbar button.

This method will always be called whenever you change the style information (or value) for a cell.

See Also

 CGXControl::LoadStyle  CGXGridCore::SetStyleRange  CGXGridCore::StoreStyleRowCol

CGXControl

 Class Overview |  Class Members