CPropertyPage::OnOK
このメンバー関数は、フレームワークによって OnKillActiveフレームワークがを呼び出した直後にユーザーが[OK]を選択するか、を適用して、ボタンがかかるときに呼び出されます。
virtual void OnOK( );
解説
ユーザーが[OK]を選択するか、を適用して、ボタンがかかる場合、プロパティ ページの 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();
}
必要条件
ヘッダー : afxdlgs.h