CPropertyPage::OnOK
此成員函式以架構會呼叫,以便在使用者選擇或判斷或套用現在按下,在這種情況下,架構會呼叫 OnKillActive之後。
virtual void OnOK( );
備註
當使用者選取或判斷或套用現在按下,架構會接收屬性頁的 PSN_APPLY 告知。 為 OnOK 就不會發出,如果您呼叫 CPropertySheet::PressButton ,因為屬性頁不傳送在這種情況下的告知。
當使用者關閉整個屬性工作表時,請覆寫這個成員函式實作其他行為特有的目前作用中的網頁。
此成員函式的預設實作指示網頁「清除」反映資料在 OnKillActive 函式更新。
範例
// 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.
CMDIFrameWnd* pframe = (CMDIFrameWnd*) AfxGetMainWnd();
CMDIChildWnd* pchild = pframe->MDIGetActive();
CPSheetDoc* doc = (CPSheetDoc*) pchild->GetActiveDocument();
doc->m_Color = m_Color;
// Tell the view to paint with the new selected color.
CView* view = pchild->GetActiveView();
view->Invalidate();
CPropertyPage::OnOK();
}
// The default MFC implementation of OnApply() would call OnOK().
BOOL CColorPage::OnApply()
{
return CPropertyPage::OnApply();
}
需求
Header: afxdlgs.h