Unable to capture ENTER key on a CEdit Control
-
I'm trying to capture the ENTER key on a CEdit Control with the OnKeyDown() function, but it seems that it is not capturing the ENTER key. All the other keys are being captured as it should. i'm using my own edit control, derived from CEdit class. Any tip ? Thanks.
-
I'm trying to capture the ENTER key on a CEdit Control with the OnKeyDown() function, but it seems that it is not capturing the ENTER key. All the other keys are being captured as it should. i'm using my own edit control, derived from CEdit class. Any tip ? Thanks.
You can catch the ENTER key in your own edit control class in PreTranslateMessage: BOOL MyClass::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) { DoAnything(); or // pMsg->wParam=0; } return CDialog::PreTranslateMessage(pMsg); } Student
-
I'm trying to capture the ENTER key on a CEdit Control with the OnKeyDown() function, but it seems that it is not capturing the ENTER key. All the other keys are being captured as it should. i'm using my own edit control, derived from CEdit class. Any tip ? Thanks.
Are you using the
ES_WANTRETURN
style?
A rich person is not the one who has the most, but the one that needs the least.