Share via


CPropertyPage::OnOK

Esta función miembro llaman el marco cuando el usuario elige la ACEPTAR o el botón de Menú de aplicar, inmediatamente después de que el marco de trabajo llama a OnKillActive.

virtual void OnOK( );

Comentarios

Cuando el usuario elige la ACEPTAR o el botón de Menú de aplicar, el marco recibe la notificación de PSN_APPLY de la página de propiedades.La llamada a OnOK no se lleve si llama a CPropertySheet:: botón porque la página de propiedades no envía la notificación en ese caso.

Invalide esta función miembro para implementar concreto adicional de comportamiento actualmente a la página activa cuando el usuario descarta la hoja de propiedades completa.

La implementación predeterminada de esta función miembro marca la página como “limpios” para reflejar que los datos se actualizan en la función de OnKillActive .

Ejemplo

// 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();
}

Requisitos

encabezado: afxdlgs.h

Vea también

Referencia

Clase de CPropertyPage

Gráfico de jerarquía

CDialog::OnOK

CPropertyPage::OnKillActive