Commit aed79e58 authored by Pascal Lessard's avatar Pascal Lessard Committed by Alexandre Julliard

Implemented the behavior around the ES_WANTRETURN style in the edit

control.
parent 540a2274
...@@ -2894,9 +2894,11 @@ static BOOL EDIT_EM_Undo(WND *wnd, EDITSTATE *es) ...@@ -2894,9 +2894,11 @@ static BOOL EDIT_EM_Undo(WND *wnd, EDITSTATE *es)
static void EDIT_WM_Char(WND *wnd, EDITSTATE *es, CHAR c, DWORD key_data) static void EDIT_WM_Char(WND *wnd, EDITSTATE *es, CHAR c, DWORD key_data)
{ {
BOOL control = GetKeyState(VK_CONTROL) & 0x8000; BOOL control = GetKeyState(VK_CONTROL) & 0x8000;
switch (c) { switch (c) {
case '\r': case '\r':
/* If the edit doesn't want the return, do nothing */
if(!(es->style & ES_WANTRETURN))
break;
case '\n': case '\n':
if (es->style & ES_MULTILINE) { if (es->style & ES_MULTILINE) {
if (es->style & ES_READONLY) { if (es->style & ES_READONLY) {
...@@ -3436,6 +3438,20 @@ static LRESULT EDIT_WM_KeyDown(WND *wnd, EDITSTATE *es, INT key, DWORD key_data) ...@@ -3436,6 +3438,20 @@ static LRESULT EDIT_WM_KeyDown(WND *wnd, EDITSTATE *es, INT key, DWORD key_data)
} else if (control) } else if (control)
EDIT_WM_Copy(wnd, es); EDIT_WM_Copy(wnd, es);
break; break;
case VK_RETURN:
/* If the edit doesn't want the return send a message to the default object */
if(!(es->style & ES_WANTRETURN))
{
HWND hwndParent = GetParent(wnd->hwndSelf);
DWORD dw = SendMessage16( hwndParent, DM_GETDEFID, 0, 0 );
if (HIWORD(dw) == DC_HASDEFID)
{
SendMessageA( hwndParent, WM_COMMAND,
MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
(LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
}
}
break;
} }
return 0; return 0;
} }
......
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