您的位置:首页 > 其它

树形控件响应Enter消息,结束编辑控件的编辑

2008-07-28 10:25 369 查看
BOOL CMyXxx::PreTranslateMessage(MSG* pMsg)
{
// If edit control is visible in tree view control, when you send a
// WM_KEYDOWN message to the edit control it will dismiss the edit
// control. When the ENTER key was sent to the edit control, the
// parent window of the tree view control is responsible for updating
// the item's label in TVN_ENDLABELEDIT notification code.
if (pMsg->message == WM_KEYDOWN &&
pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
{
CEdit* edit = m_TreeCtrl.GetEditControl();
if (edit)
{
edit->SendMessage(WM_KEYDOWN, pMsg->wParam, pMsg->lParam);
return TRUE;
}
}
// CXxxx can be a CFormView, Cdialog, or CPropertyPage class.
return CXxxx::PreTranslateMessage(pMsg);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: