user32: Correctly handle VK_RETURN for edit controls with ES_WANTRETURN style.
This commit is contained in:
parent
08a4d2afc2
commit
376e45429c
|
@ -811,9 +811,6 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
|
|||
{
|
||||
switch (vk)
|
||||
{
|
||||
case VK_RETURN:
|
||||
SendMessageW(GetParent(hwnd), WM_COMMAND, IDOK, (LPARAM)GetDlgItem(GetParent(hwnd), IDOK));
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
SendMessageW(GetParent(hwnd), WM_CLOSE, 0, 0);
|
||||
break;
|
||||
|
@ -4608,6 +4605,8 @@ static LRESULT EDIT_WM_KeyDown(EDITSTATE *es, INT key)
|
|||
MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
|
||||
(LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
|
||||
}
|
||||
else
|
||||
SendMessageW( hwndParent, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hwndParent, IDOK ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ static struct edit_notify notifications;
|
|||
|
||||
static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
static int num_ok_commands = 0;
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
@ -62,6 +63,13 @@ static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wpara
|
|||
PostMessage(hdlg, WM_USER, 0xdeadbeef, 0);
|
||||
break;
|
||||
|
||||
/* test cases for pressing enter */
|
||||
case 3:
|
||||
num_ok_commands = 0;
|
||||
PostMessage(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
|
||||
PostMessage(hdlg, WM_USER, 0xdeadbeef, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -75,11 +83,7 @@ static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wpara
|
|||
switch (LOWORD(wparam))
|
||||
{
|
||||
case IDOK:
|
||||
EndDialog(hdlg, 111);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hdlg, 222);
|
||||
num_ok_commands++;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -109,6 +113,12 @@ static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wpara
|
|||
else
|
||||
EndDialog(hdlg, 4444);
|
||||
break;
|
||||
case 1:
|
||||
if ((hfocus == hedit) && (num_ok_commands == 0))
|
||||
EndDialog(hdlg, 11);
|
||||
else
|
||||
EndDialog(hdlg, 22);
|
||||
break;
|
||||
default:
|
||||
EndDialog(hdlg, 5555);
|
||||
}
|
||||
|
@ -1441,6 +1451,8 @@ static void test_multi_edit_dialog(void)
|
|||
ok(1111 == r, "Expected %d, got %d\n", 1111, r);
|
||||
r = DialogBoxParam(hinst, "MULTI_EDIT_DIALOG", NULL, (DLGPROC)multi_edit_dialog_proc, 2);
|
||||
ok(2222 == r, "Expected %d, got %d\n", 2222, r);
|
||||
r = DialogBoxParam(hinst, "MULTI_EDIT_DIALOG", NULL, (DLGPROC)multi_edit_dialog_proc, 3);
|
||||
ok(11 == r, "Expected %d, got %d\n", 11, r);
|
||||
}
|
||||
|
||||
static BOOL RegisterWindowClasses (void)
|
||||
|
|
|
@ -103,7 +103,7 @@ STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER
|
|||
CAPTION "Multiple Edit Test"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
{
|
||||
EDITTEXT 1000, 5, 5, 150, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
EDITTEXT 1000, 5, 5, 150, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | ES_WANTRETURN
|
||||
EDITTEXT 1001, 5, 25, 150, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
EDITTEXT 1002, 5, 45, 150, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue