user32: Handle VK_RETURN WM_KEYDOWN events better in edit controls.

Elias Benali wrote the initial version of this patch.
This commit is contained in:
Lei Zhang 2008-04-23 17:58:30 -07:00 committed by Alexandre Julliard
parent 1e5faee29e
commit 2f0b111243
2 changed files with 8 additions and 4 deletions

View File

@ -4602,8 +4602,12 @@ static LRESULT EDIT_WM_KeyDown(EDITSTATE *es, INT key)
/* If the edit doesn't want the return send a message to the default object */
if(!(es->style & ES_MULTILINE) || !(es->style & ES_WANTRETURN))
{
HWND hwndParent = GetParent(es->hwndSelf);
DWORD dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 );
HWND hwndParent;
DWORD dw;
if (!EDIT_IsInsideDialog(es)) return 1;
hwndParent = GetParent(es->hwndSelf);
dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 );
if (HIWORD(dw) == DC_HASDEFID)
{
SendMessageW( hwndParent, WM_COMMAND,

View File

@ -1932,8 +1932,8 @@ static void test_child_edit_wmkeydown(void)
hwParent = GetParent(hwEdit);
SetWindowLong(hwParent, GWL_WNDPROC, (LONG)child_edit_wmkeydown_proc);
r = SendMessage(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
todo_wine ok(1 == r, "expected 1, got %d\n", r);
todo_wine ok(0 == child_edit_wmkeydown_num_messages, "expected 0, got %d\n", child_edit_wmkeydown_num_messages);
ok(1 == r, "expected 1, got %d\n", r);
ok(0 == child_edit_wmkeydown_num_messages, "expected 0, got %d\n", child_edit_wmkeydown_num_messages);
destroy_child_editcontrol(hwEdit);
}