Accelerators processing before CMFCPropertyGridCtrl
I am having a problem with accelerators processing before CMFCPropertyGridCtrl. So if you are editing a text box and press 'delete', it executes the accelerator command instead of deleteing a character in the edit box. How can I resolve this issue?
Implement the PreTranslateMessage function and, depending on whether the property grid has focus or not, pass the message to accelerator or not.
Code:
m_hAccel = ::LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MYDIALOG)); BOOL CMyDialog::PreTranslateMessage(MSG* pMsg) { ... if(m_hAccel && ...not grid has focus...) { if(::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) return(TRUE); } return CDialog::PreTranslateMessage(pMsg); }