Control questions on Property pages
-
I have a property page with at least 2 edit controls. When the user presses enter on the first edit box, I want the 2nd edit box to become active and gain focus. I have tried:
void PropPageHello::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call defaultCPropertyPage::OnKeyDown(nChar, nRepCnt, nFlags);
}
If you put a break pointin this function, it is never hit. I am not sure how to capture the enter key and set the focus of the next item.
-
I have a property page with at least 2 edit controls. When the user presses enter on the first edit box, I want the 2nd edit box to become active and gain focus. I have tried:
void PropPageHello::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call defaultCPropertyPage::OnKeyDown(nChar, nRepCnt, nFlags);
}
If you put a break pointin this function, it is never hit. I am not sure how to capture the enter key and set the focus of the next item.
instead of OnKeyDown, try PreTranslateMessage:
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN)
{
// got an enter
}
}
return CDialog::PreTranslateMessage(pMsg);
} -
instead of OnKeyDown, try PreTranslateMessage:
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
if(pMsg->wParam==VK_RETURN)
{
// got an enter
}
}
return CDialog::PreTranslateMessage(pMsg);
}