I have seen so many posts about how to prevent the escape key from closing a CDIalog but in my case I want to close the dialog but it doesn`t.
I have created a sample MFC Dialog application thats adds property sheet and 2 property pages. I tried putting pretranslatemessage, OnCancel, KillFocus overrides into the property pages and the dialog but that doesn't get hit. Used following code:
#include "proppage1.h"
#include "proppage2.h"
#include "mySheet.h"
// ......
protected:
// proppage1,proppage2 are the class dervied from CPropertyPage
proppage1 pg1;
proppage2 pg2;
// mySheet is the class dervied from CPropertySheet
mySheet *m_sheet;
In CMFCDlg::OnInitDialog() of MFCDlg.CPP
m_sheet = new mySheet(L"mySheet",this,0);
m_sheet->AddPage(&pg1);
m_sheet->AddPage(&pg2);
m_sheet->Create(this, WS_CHILD | WS_VISIBLE , 0);
m_sheet->ModifyStyleEx (0, WS_EX_CONTROLPARENT);
m_sheet->ModifyStyle( 0, WS_TABSTOP );
I dont get any events fired in propertypages and dialog. If I place some controls on the property pages, then events are fired and can be catched in property pages. However,in other case why wouldn't the Esc and other event get fired?
Please suggest?
Thanks, Nikhil