Accelerators processing before CMFCPropertyGridCtrl

来源:互联网 发布:三星一体机扫描软件 编辑:程序博客网 时间:2024/05/20 02:51
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);}
原创粉丝点击