virtual void OnOK( );
Remarks
This member function is called by the framework when the user chooses either the OK or Apply Now button, immediately after the framework calls OnKillActive. Override this member function to implement additional behavior specific to the currently active page when user dismisses the entire property sheet.
The default implementation of this member function marks the page as “clean” to reflect that the data was updated in the OnKillActive function.
Example
// Accept the new color selection and dismiss the CPropertySheet
// dialog. The view's object will be painted with the new selected
// color. CColorPage is a CPropertyPage-derived class.
void CColorPage::OnOK()
{
// Store the new selected color to a member variable of
// document class. m_Color is a member varible of CColorPage
// and it stores the new selected color. doc->m_Color is
// the color saved in the document class and it is the color
// used by the view class.
CFrameWnd* frame = (CFrameWnd*) AfxGetMainWnd();
CPSheetDoc* doc = (CPSheetDoc*) frame->GetActiveDocument();
doc->m_Color = m_Color;
// Tell the view to paint with the new selected color.
CView* view = frame->GetActiveView();
view->Invalidate();
CPropertyPage::OnOK();
}
// The default MFC implementation of OnApply() would call OnOK().
BOOL CColorPage::OnApply()
{
return CPropertyPage::OnApply();
}
CPropertyPage Overview | Class Members | Hierarchy Chart
See Also CDialog::OnOK, CPropertyPage::OnKillActive