Edit - wants all keys when multiline

Vitaliy Margolen wine-patch at kievinfo.com
Sun Oct 31 12:33:31 CST 2004


changelog:
  dlls/user32/edit.c
  - return "want all keys" if multi-line
  - tests to confirm it
-------------- next part --------------
Index: dlls/user/edit.c
===================================================================
RCS file: /home/wine/wine/dlls/user/edit.c,v
retrieving revision 1.3
diff -u -r1.3 edit.c
--- dlls/user/edit.c	16 Sep 2004 20:28:10 -0000	1.3
+++ dlls/user/edit.c	31 Oct 2004 18:26:44 -0000
@@ -761,6 +761,12 @@
 
 	case WM_GETDLGCODE:
 		result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
+		
+		if (GetWindowLongW( hwnd, GWL_STYLE ) & ES_MULTILINE)
+		{
+		   result |= DLGC_WANTALLKEYS;
+		   break;
+		}
 
 		if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
 		{
Index: dlls/user/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/Makefile.in,v
retrieving revision 1.11
diff -u -r1.11 Makefile.in
--- dlls/user/tests/Makefile.in	20 Jul 2004 22:09:14 -0000	1.11
+++ dlls/user/tests/Makefile.in	31 Oct 2004 18:26:44 -0000
@@ -18,7 +18,8 @@
 	sysparams.c \
 	text.c \
 	win.c \
-	wsprintf.c
+	wsprintf.c \
+	edit.c
 
 RC_SRCS = resource.rc
 
--- /dev/null	2003-12-16 03:57:18.000000000 -0700
+++ dlls/user/tests/edit.c	2004-10-31 11:24:37.000000000 -0700
@@ -0,0 +1,90 @@
+/* Unit test suite for edit control.
+ *
+ * Copyright 2004 Vitaliy Margolen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <assert.h>
+#include <windows.h>
+#include <commctrl.h>
+
+#include "wine/test.h"
+
+HWND
+create_editcontrol (DWORD style)
+{
+    HWND handle;
+
+    handle = CreateWindow("EDIT",
+			  NULL,
+			  ES_LEFT  | style,
+			  10, 10,300, 300,
+			  NULL, NULL, NULL, NULL);
+
+
+    assert (handle);
+
+    if (winetest_interactive)
+	ShowWindow (handle, SW_SHOW);
+
+    return handle;
+}
+
+START_TEST(edit)
+{
+    HWND hwEdit;
+    MSG msMessage;
+    int i, r;
+
+    msMessage.message = WM_KEYDOWN;
+
+    if (winetest_interactive) trace("Single line\n");
+    hwEdit = create_editcontrol(0);
+    for (i=0;i<65535;i++)
+    {
+	msMessage.wParam = i;
+	r = SendMessage(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
+	ok(r==0x89, "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
+    }
+    DestroyWindow (hwEdit);
+    if (winetest_interactive) trace("Single line want returns\n");
+    hwEdit = create_editcontrol(ES_WANTRETURN);
+    for (i=0;i<65535;i++)
+    {
+	msMessage.wParam = i;
+	r = SendMessage(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
+	ok(r==0x89, "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
+    }
+    DestroyWindow (hwEdit);
+    if (winetest_interactive) trace("Multiline line\n");
+    hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL);
+    for (i=0;i<65535;i++)
+    {
+	msMessage.wParam = i;
+	r = SendMessage(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
+	ok(r==0x8d, "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
+    }
+    DestroyWindow (hwEdit);
+    if (winetest_interactive) trace("Multi line want returns\n");
+    hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_WANTRETURN);
+    for (i=0;i<65535;i++)
+    {
+	msMessage.wParam = i;
+	r = SendMessage(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
+	ok(r==0x8d, "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
+    }
+    DestroyWindow (hwEdit);
+}


More information about the wine-patches mailing list