I have just encountered an issue with CPropertyPage
.
I have been trying to use the OnOK
handler to do some validation:
void CCalendarSettingsGooglePage::OnOK()
{
bool bHandle = false;
UpdateData(TRUE);
// AJT v20.2.0 — We need to pass "true" so that the error message will display!
if (ValidSettings(true))
{
bHandle = true;
SaveSettings();
}
if (bHandle)
CMFCPropertyPage::OnOK();
}
The problem is, the sheet still closes down. I had hoped that preventing the CMFCPropertyPage::OnOK
would have stopped the sheet closing. But it doesn't.
I understand from here that the sheet's OnOK
is making a EndDialog(IDOK)
call. But i don't want to complicate my sheet. The testing is here in this page. so I need a was for the sheet to know if it should close or not when user clicks the OK button.