[ros-diffs] [gbrunmar] 33909: Fixed 11 winetests for edit boxes based on code from wine but tweaked for ReactOS

gbrunmar at svn.reactos.org gbrunmar at svn.reactos.org
Mon Jun 9 21:07:55 CEST 2008


Author: gbrunmar
Date: Mon Jun  9 14:07:54 2008
New Revision: 33909

URL: http://svn.reactos.org/svn/reactos?rev=33909&view=rev
Log:
Fixed 11 winetests for edit boxes based on code from wine but tweaked for ReactOS

Modified:
    trunk/reactos/dll/win32/user32/controls/edit.c

Modified: trunk/reactos/dll/win32/user32/controls/edit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/edit.c?rev=33909&r1=33908&r2=33909&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] Mon Jun  9 14:07:54 2008
@@ -4084,6 +4084,27 @@
 	return TRUE;
 }
 
+/* Helper function for WM_CHAR
+ *
+ * According to an MSDN blog article titled "Just because you're a control
+ * doesn't mean that you're necessarily inside a dialog box," multiline edit
+ * controls without ES_WANTRETURN would attempt to detect whether it is inside
+ * a dialog box or not.
+ */
+static BOOL EDIT_IsInsideDialog(EDITSTATE *es)
+{
+    if (es->hwndParent && es->hwndParent != GetDesktopWindow())
+    {
+        PWINDOW pParent = ValidateHwnd( es->hwndParent );
+
+        /* TODO: This should really check fnID instead of ExtraDataSize I guess */
+        if (pParent && pParent->ExtraDataSize >= DLGWINDOWEXTRA)
+        {
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
 
 /*********************************************************************
  *
@@ -4717,21 +4738,36 @@
 		} else if (control)
 			EDIT_WM_Copy(es);
 		break;
-	case VK_RETURN:
-	    /* If the edit doesn't want the return send a message to the default object */
-	    if(!(es->style & ES_WANTRETURN))
+    case VK_RETURN:
+        /* 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 );
-		if (HIWORD(dw) == DC_HASDEFID)
-		{
-		    SendMessageW( hwndParent, WM_COMMAND,
-				  MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
- 			      (LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
-		}
-	    }
-	    break;
-	}
+            HWND hwndParent;
+            DWORD dw;
+
+            if (!EDIT_IsInsideDialog(es)) return 1;
+            if (control) break;
+
+            hwndParent = GetParent(es->hwndSelf);
+            dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 );
+            if (HIWORD(dw) == DC_HASDEFID)
+            {
+                SendMessageW( hwndParent, WM_COMMAND,
+                      MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
+                      (LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
+            }
+            else
+                SendMessageW( hwndParent, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hwndParent, IDOK ) );
+        }
+        break;
+    case VK_ESCAPE:
+        if (!(es->style & ES_MULTILINE))
+            SendMessageW(GetParent(es->hwndSelf), WM_COMMAND, IDCANCEL, (LPARAM)GetDlgItem( GetParent(es->hwndSelf), IDCANCEL ) );
+        break;
+    case VK_TAB:
+        SendMessageW(es->hwndParent, WM_NEXTDLGCTL, shift, 0);
+        break;
+    }
 	return 0;
 }
 



More information about the Ros-diffs mailing list