CPropertyPage::OnKillActive

 

This member function is called by the framework when the page is no longer the active page.

Syntax

virtual BOOL OnKillActive( );

Return Value

Nonzero if data was updated successfully, otherwise 0.

Remarks

Override this member function to perform special data validation tasks.

The default implementation of this member function copies settings from the controls in the property page to the member variables of the property page. If the data was not updated successfully due to a dialog data validation (DDV) error, the page retains focus.

After this member function returns successfully, the framework will call the page's OnOK function.

Example

// Validate the value entered to the "Number" edit control. Its
// value must be at least one. If not, tell the user and set the
// focus to the "Number" edit control. CStylePage is a 
// CPropertyPage-derived class.
BOOL CStylePage::OnKillActive() 
{
   int num = GetDlgItemInt(IDC_NUMOBJECTS);
   if (num <= 0)
   {
      AfxMessageBox(_T("Number of objects must be at least 1."));
      CEdit* edit = (CEdit*) GetDlgItem(IDC_NUMOBJECTS);
      edit->SetFocus();
      edit->SetSel(0, -1);
      return 0;
   }

   return CPropertyPage::OnKillActive();
}

Requirements

Header: afxdlgs.h

See Also

CPropertyPage Class
Hierarchy Chart
CWnd::UpdateData
CPropertyPage::OnOK
CPropertyPage::OnSetActive