Click to See Complete Forum and Search --> : Child DialogBox doesn't receive ENTER keyboard input


jflefebvre_org
June 6th, 2005, 09:08 AM
Hi.

I created a application for which the main window is a modeless dialog.
This dialog has a child modeless dialog wich contains 2 buttons.

I'm able to TAB around the controls, passing from the parent dialog's
control to the child's ones as expected.

However, when the focus is on one of the child buttons and I hit the
ENTER key, it is the parent dialog that receive the WM_COMMAND message.
What is strange is that if I hit SPACE_BAR (wich simulate a mouse
click) instead of ENTER, my child dialog is correctly notified.

Here is my main loop :

while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
{
if (bRet == -1)
{
throw runtime_error("Fatal Message Error");
}
else
{
HWND hWnd = GetActiveWindow();
if (!TranslateAccelerator(hWnd, roDatabase.s_hAcceleratorTable,
&msg))
{
if ((hWnd == NULL) || !IsDialogMessage(hWnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}

}

Anyone have had this bug??? Anyone have resolved it???
Thanks.

JF