共用方式為


CPropertyPage::SetModified

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.

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

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. 
// Its entry in the message map looks like this: 
// ON_CONTROL_RANGE(BN_CLICKED, IDC_BLACK, IDC_GREEN, CColorPage::OnColorClicked) 
void CColorPage::OnColorClicked(UINT nCmdID)
{
   COLORREF color = m_Color;
   switch (nCmdID)
   {
   case IDC_RADIOBLACK:
      color = RGB(0, 0, 0);
      m_radioColor = crBlack;
      break;

   case IDC_RADIORED:
      color = RGB(255, 0, 0);
      m_radioColor = crRed;
      break;

   case IDC_RADIOGREEN:
      color = RGB(0, 255, 0);
      m_radioColor = crGreen;
      break;

   case IDC_RADIOBLUE:
      color = RGB(0, 0, 255);
      m_radioColor = crBlue;
      break;
   }

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

   UpdateData(FALSE);
}

Requirements

Header: afxdlgs.h

See Also

Reference

CPropertyPage Class

Hierarchy Chart

CPropertyPage::CancelToClose