CGXGridCore::RefreshViews

virtual BOOL RefreshViews(BOOL bRecalc = TRUE, CString* pErrorStr = NULL, BOOL bCreateHint = TRUE);

bRecalc

TRUE if Recalc should be called and formulas that depend on changed cells should be recalculated.

pErrorStr

A pointer to a CString where the method will store error description if an error occurred. Can be NULL.

bCreateHint

TRUE if a hint should get sent to other views so that they get refreshed, too.

Remarks

RefreshViews invalidates the whole grid display area and then loops through all visible cells and checks GetUpdateFlag. Only cells that are marked via GetUpdateFlag will be painted. Typically the update flag is set in the formula engine whenever a cell has changed or when a formula expression that has a reference to a changed cell was reevaluated.

Typically RefreshViews will be called after the user has changed a cell. RefreshViews will then refresh all cells that have dependencies on the changed cell.

The method creates the following hint:

   CGXGridHint hint(gxHintRefreshViews, m_nViewID);
   hint.vptr = pErrorStr;

Example:

void CGridSampleView::OnEditConstraintcheck()
{
   GetSheetContext()->SetConstraintCheck(!GetSheetContext()->GetConstraintCheck());
   RefreshViews(TRUE); // Recalculate all formula cells and repaint those cells that have changed
}

See Also

 CGXGridCore::GetUpdateFlag

CGXGridCore

 Class Overview |  Class Members