OnKeyDown() ignored?
-
I'm incerting the OnKeyDown function to catch keyboard events.. Problem is it never makes it to the function.. void MyDlg::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ) { AfxMessageBox(L"Got a key stroke"); <-- never pops up CDialog::OnKeyDown( nChar, nRepCnt, nFlags ); return; } I've got an OnMouseWheel funtion in that works perfectly.. So I have OnKeyDown set in the same way.. Any Ideas?
-
I'm incerting the OnKeyDown function to catch keyboard events.. Problem is it never makes it to the function.. void MyDlg::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ) { AfxMessageBox(L"Got a key stroke"); <-- never pops up CDialog::OnKeyDown( nChar, nRepCnt, nFlags ); return; } I've got an OnMouseWheel funtion in that works perfectly.. So I have OnKeyDown set in the same way.. Any Ideas?
Do you have a WM_KEYDOWN entry in the window class' message map? The WM_KEYDOWN will go to the window with keyboard focus. In a dialog this may be one of the controls in the dialog. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Do you have a WM_KEYDOWN entry in the window class' message map? The WM_KEYDOWN will go to the window with keyboard focus. In a dialog this may be one of the controls in the dialog. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
yes I have ON_WM_KEYDOWN() in the message map.. hmmmm.. the function is just not hitting..
-
yes I have ON_WM_KEYDOWN() in the message map.. hmmmm.. the function is just not hitting..
Then the window whos class your catching it in doesn't have keyboard focus. Try using SetFocus() to set the keyboard focus to the dialog and see if it starts to work. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Then the window whos class your catching it in doesn't have keyboard focus. Try using SetFocus() to set the keyboard focus to the dialog and see if it starts to work. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
I must be overiding the keyboard somewhere because I've used SetFocus(), and my OnMouseWheel works to proove it focus.. Looks like I'll have to hunt for the block.. :) Thanks Mark..
-
Then the window whos class your catching it in doesn't have keyboard focus. Try using SetFocus() to set the keyboard focus to the dialog and see if it starts to work. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
I must be overiding the keyboard somewhere because I've used SetFocus(), and my OnMouseWheel works to proove it's focus.. Looks like I'll have to hunt for the block.. :) Thanks Mark..
-
I must be overiding the keyboard somewhere because I've used SetFocus(), and my OnMouseWheel works to proove it's focus.. Looks like I'll have to hunt for the block.. :) Thanks Mark..
Hmm.. still having trouble with this one... I've started a whole new dialog that I can open child dialogs within.. OnKeyDown() works until I add an object to the parent dialog or open a child dialog.. I've tried SetFocus() every which way possible.. It's just not happening.. There must be a way...