iamcreatingamfcprogramusingthedocument/view architecture.intheviewicallonacellclassthatextendscedittodrawatextbox.thatworatwor whenitrytocatchalosefocusmessageforthattextboxnothinghappens.itriedtooverwritepretranslatemessagebutthatdidn ' twork。
here ' sthecodeinthecgridview.CPP class :
voidcgridview :3360 on插入文本(
{
CWnd* pParentWnd=this;
zddxrz pEdit=new热月饼(grid,pParentWnd );
Invalidate (;
}
the热月饼. cpp:
{
cedit.create (es _ multiline ) ws _ child|ws _ visible|ws _ tabstop|ws _ border,crect ) pcoordinates10,* ()
cell=p网格- getselectedcell (;
p网格设置(cell,' text ';
网格=p网格;
}
BEGIN_MESSAGE_MAP (热月饼,CEdit ) )。
ON_WM_KILLFOCUS ()
ON_WM_KEYDOWN ()
END_MESSAGE_MAP (
/热月饼消息处理程序
void热月饼:3360 Onkillfocus (cwnd * pnew wnd ) ) )。
{
cedit :3360 onkillfocus (pnew wnd );
网格集热月饼(cell,str );
cedit.DestroyWindow (;
}
(BOOL热月饼: 3360 pretranslatemessage (msg * pmsg ) ) ) ) ) ) ) )。
{
if(pmsg-message==WM_keydown ) )。
{
if(pmsg-wparam==vk_up ) ) )。
{
}
}
return cwnd :3360 pretranslatemessage (pmsg;
}
When I debug,theonkillfocusandpretranslatemessagearen ' tcalledatall。
Thanks,
youhavetohandletheen _ killfocusnotificationcodeintheparentwindow.you shouldn ' thavetoderivefromcedittodothat。
更新:
theparentwindowoftheeditcontrolreceivesthisnotificationcode
through a WM_COMMAND message。
waram : thelowordcontainstheidentifieroftheeditcontrol.the
lparam : -手持设备控制。