CPropertyPage::SetModified

void SetModified( BOOL bChanged = TRUE );

Parameters

bChanged

TRUE to indicate that the property page settings have been modified since the last time they were applied; FALSE to indicate that the property page settings have been applied, or should be ignored.

Remarks

Call this member function to enable or disable the Apply Now button, based on whether the settings in the property page should be applied to the appropriate external object.

The framework keeps track of which pages are “dirty,” that is, property pages for which you have called SetModified( TRUE ). The Apply Now button will always be enabled if you call SetModified( TRUE ) for one of the pages. The Apply Now button will be disabled when you call SetModified( FALSE ) for one of the pages, but only if none of the other pages is “dirty.”

Example

// OnColorClicked() is a member function of CColorPage (a
// CPropertyPage-derived class). It is called whenever a radio button
// is selected on the page. Call SetModified() to enable the Apply 
// button whenever a new selection is made. m_Color is a member
// variable of CColorPage and it is to store the selected RGB color.

BEGIN_MESSAGE_MAP(CColorPage, CPropertyPage)
   ON_CONTROL_RANGE(BN_CLICKED, IDC_BLACK, IDC_BLUE, OnColorClicked)
   //{{AFX_MSG_MAP(CColorPage)
   //}}AFX_MSG_MAP
END_MESSAGE_MAP()

void CColorPage::OnColorClicked(UINT nCmdID)
{
   COLORREF color;
   switch (nCmdID)
   {
   case IDC_BLACK:
      color = RGB(0, 0, 0);
      break;

   case IDC_RED:
      color = RGB(255, 0, 0);
      break;

   case IDC_GREEN:
      color = RGB(0, 255, 0);
      break;

   case IDC_BLUE:
      color = RGB(0, 0, 255);
      break;
   }

   if (color != m_Color)
   {
      m_Color = color;
      SetModified();    // Enable Apply Now button.
   }
}

CPropertyPage OverviewClass MembersHierarchy Chart

See Also   CPropertyPage::CancelToClose