vc如何實現按下回車後編輯框輸入焦點傳遞到下一編輯框?控件如何綁定類?
在對話框界面按下Ctrl+D組合鍵,將各個控件的Order進行排序,設置你想要的次序,設置好後,添加PreTranslateMessage函數並加入如下代碼···
試試吧
BOOL CCodeMess::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(WM_KEYDOWN==pMsg->message&&VK_RETURN==pMsg->wParam)
{
TCHAR szClass[MAX_PATH]={0};
::GetClassName(pMsg->hwnd,szClass,MAX_PATH-1);
if(0==_tcscmp(szClass,_T("Edit")))
{
HWND hWnd=pMsg->hwnd;
while(NULL!=(hWnd=::GetWindow(hWnd,GW_HWNDNEXT)))
{
::GetClassName(hWnd,szClass,MAX_PATH-1);
if(0==_tcscmp(szClass,_T("Edit")))
{
::SetFocus(hWnd);
return TRUE;
}
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}