Commit a50ca4ac authored by Sergey Khodych's avatar Sergey Khodych Committed by Alexandre Julliard

riched20: Implement handling of WM_KEYDOWN VK_ESCAPE in the dialog mode.

parent 8fb119ba
......@@ -2289,6 +2289,10 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
return TRUE;
}
break;
case VK_ESCAPE:
if (editor->bDialogMode && editor->hwndParent)
PostMessageW(editor->hwndParent, WM_CLOSE, 0, 0);
return TRUE;
case 'A':
if (ctrl_is_down)
{
......
......@@ -6831,6 +6831,11 @@ static void test_dialogmode(void)
ok(2 == lcount, "expected 2, got %d\n", lcount);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 0, 0);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
test_dm_messages(0, 0, 0);
......@@ -6843,6 +6848,11 @@ static void test_dialogmode(void)
lcount = SendMessage(hwRichEdit, EM_GETLINECOUNT, 0, 0);
ok(2 == lcount, "expected 2, got %d\n", lcount);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 0, 0);
hwButton = CreateWindow("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
......@@ -6871,6 +6881,11 @@ static void test_dialogmode(void)
ok(2 == lcount, "expected 2, got %d\n", lcount);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 0, 0);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
ok(0x8f == r, "expected 0x8f, got 0x%x\n", r);
test_dm_messages(0, 0, 0);
......@@ -6883,6 +6898,11 @@ static void test_dialogmode(void)
lcount = SendMessage(hwRichEdit, EM_GETLINECOUNT, 0, 0);
ok(3 == lcount, "expected 3, got %d\n", lcount);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 0, 0);
hwButton = CreateWindow("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
......@@ -6908,6 +6928,11 @@ static void test_dialogmode(void)
test_dm_messages(0, 0, 0);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 0, 0);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
ok(0x8b == r, "expected 0x8b, got 0x%x\n", r);
test_dm_messages(0, 0, 0);
......@@ -6917,6 +6942,11 @@ static void test_dialogmode(void)
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 1, 0);
memset(&dm_messages, 0, sizeof(dm_messages));
r = SendMessage(hwRichEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
ok(0 == r, "expected 0, got %d\n", r);
test_dm_messages(0, 0, 0);
hwButton = CreateWindow("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
100, 100, 50, 20, hwParent, (HMENU)ID_RICHEDITTESTDBUTTON, GetModuleHandleA(0), NULL);
ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment