ESC Key on a CFormView
-
I have a CFormView and I need to capture the ESC key. The control the has the focus always receive the OnChar but the form never does. I don't want to use an Accelerator nor any code on the controls. Any Ideas?
Just a guess: Override
PreTranslateMessage
in your CFormView. Mazy "And the carpet needs a haircut, and the spotlight looks like a prison break And the telephone's out of cigarettes, and the balcony is on the make And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits -
I have a CFormView and I need to capture the ESC key. The control the has the focus always receive the OnChar but the form never does. I don't want to use an Accelerator nor any code on the controls. Any Ideas?
-
thats how i did it.. here is some code from one of my dialogs that is derived from CFormView.. in my .h
BOOL PreTranslateMessage(MSG\* pMsg);
in my .cpp
BOOL CST3WKSHT::PreTranslateMessage(MSG* pMsg)
{
CSCTaxApp* pApp = (CSCTaxApp*)AfxGetApp();
if(pMsg->message==WM_KEYDOWN && pApp->m_bEnterAsTab)
{
if(pMsg->wParam==VK_RETURN)
pMsg->wParam=VK_TAB;
}
return CFormView::PreTranslateMessage(pMsg);
}this converts my keypresses from enters to tabs.. and it does work.. hope that helps still a newb.. cut me some slack :P -dz
-
I have a CFormView and I need to capture the ESC key. The control the has the focus always receive the OnChar but the form never does. I don't want to use an Accelerator nor any code on the controls. Any Ideas?