MFC Edit Box - Multiple Characters Per Key Press?
I am trying to create a simple dialog in MFC using Visual C ++. My problem is that when I get the dialog on screen and try to enter the "Edit Field" field, if I type the letter "a" once, it appears in the edit field as "aaaaaaaaaaa" (that's 12 a). Also, if I try to navigate in the window using the arrow keys, the carat moves 12 characters at a time.
This is not just a display error, as the output from the edit box is still "aaaaaaaaaaaa".
I would post the code, but not actually post anything. I added an edit box using the toolbar in Visual Studio and assigned a variable to it in my class, so this is not any special edit box.
If anyone has any thoughts about what might happen it will be very helpful. Unfortunately, I don't know where to start.
Thanks as always.
source to share
To debug this, add the PreTranslateMessage function to your dialog and see how many times the keydown is processed.
BOOL DialogName::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
// TODO: see what is going on here
return TRUE; //do not dispatch this message, so keydown will have no effect
}
return CDialog::PreTranslateMessage(pMsg);
}
source to share
For some reason, this brings back vague memories of the early battles with MFC. Have you ever looked for mutual recursion? I was always doing something in the same application that sent a message (unknown to me) that was picked up by another method that called the first method ...
My guess is one of those who hit the forehead; it gives me this nagging feeling of déjà vu that I can't make concrete.
If it is mutual recursion, you should be able to see it in the call stack if you can find the right place for the breakpoint.
source to share