user32: Handle WM_CHAR messages better in edit controls.

This commit is contained in:
Lei Zhang 2008-03-27 12:22:04 -07:00 committed by Alexandre Julliard
parent 5d6bf737db
commit 0fac05b977
2 changed files with 19 additions and 9 deletions

View file

@ -853,12 +853,22 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);
} }
if ((charW == VK_RETURN || charW == VK_ESCAPE) && es->hwndListBox) if (es->hwndListBox)
{ {
if (SendMessageW(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0)) if (charW == VK_RETURN || charW == VK_ESCAPE)
SendMessageW(GetParent(hwnd), WM_KEYDOWN, charW, 0); {
break; if (SendMessageW(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0))
} {
SendMessageW(GetParent(hwnd), WM_KEYDOWN, charW, 0);
break;
}
}
}
else
{
if (charW == VK_TAB || charW == VK_RETURN)
break;
}
EDIT_WM_Char(es, charW); EDIT_WM_Char(es, charW);
break; break;
} }

View file

@ -1296,9 +1296,9 @@ static void test_edit_dialog(void)
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 3); r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 3);
ok(444 == r, "Expected %d, got %d\n", 444, r); ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 4); r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 4);
todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r); ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 5); r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 5);
todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r); ok(444 == r, "Expected %d, got %d\n", 444, r);
/* tests for WM_KEYDOWN + WM_CHAR */ /* tests for WM_KEYDOWN + WM_CHAR */
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 6); r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 6);
@ -1306,7 +1306,7 @@ static void test_edit_dialog(void)
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 7); r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 7);
todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r); todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r);
r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 8); r = DialogBoxParam(hinst, "EDIT_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 8);
todo_wine ok(444 == r, "Expected %d, got %d\n", 444, r); ok(444 == r, "Expected %d, got %d\n", 444, r);
} }
static BOOL RegisterWindowClasses (void) static BOOL RegisterWindowClasses (void)