Author: pbartok
Date: 2006-07-21 15:17:30 -0400 (Fri, 21 Jul 2006)
New Revision: 62876

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
Log:
2006-07-21  Peter Dennis Bartok  <[EMAIL PROTECTED]> 

        * Control.cs (GetNextControl): Fixes to make all of Jackson's unit 
          tests pass and match MS in some strange border cases.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-07-21 18:27:30 UTC (rev 62875)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-07-21 19:17:30 UTC (rev 62876)
@@ -1,3 +1,8 @@
+2006-07-21  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
+
+       * Control.cs (GetNextControl): Fixes to make all of Jackson's unit 
+         tests pass and match MS in some strange border cases.
+
 2006-07-21  Chris Toshok  <[EMAIL PROTECTED]>
 
        * ThemeWin32Classic.cs: handle drawing of the relation links and

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-07-21 18:27:30 UTC (rev 62875)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-07-21 19:17:30 UTC (rev 62876)
@@ -1225,18 +1225,24 @@
 
                        if (start != null) {
                                found = FindFlatBackward(start.parent, start);
-                               if (found == null && start.parent != container) 
{
-                                       return start.parent;
+                               if (found == null) {
+                                       if (start.parent != container) {
+                                               return start.parent;
+                                       }
+                               } else {
+                                       return found;
                                }
                        }
                        if (found == null) {
                                found = FindFlatBackward(container, start);
                        }
 
-                       while ((found != null) && ((found is IContainerControl) 
|| found.GetStyle(ControlStyles.ContainerControl))) {
-                               found = FindControlBackward(found, null);
-                               if (found != null) {
-                                       return found;
+                       if (container != start) {
+                               while ((found != null) && 
(!found.Contains(start)) && ((found is IContainerControl) || 
found.GetStyle(ControlStyles.ContainerControl))) {
+                                       found = FindControlBackward(found, 
null);
+                                       if (found != null) {
+                                               return found;
+                                       }
                                }
                        }
 
@@ -2740,6 +2746,21 @@
                                return null;
                        }
 
+                       // Special cases
+                       if (this == ctl) {
+                               if (!forward) {
+                                       return FindFlatBackward(ctl, null);
+                               }
+                       } else {
+                               if ((parent == null) && (ctl is 
IContainerControl) && ctl.GetStyle(ControlStyles.ContainerControl)) {
+                                       if (forward) {
+                                               return FindFlatForward(this, 
ctl);
+                                       } else {
+                                               return FindFlatBackward(this, 
ctl);
+                                       }
+                               }
+                       }
+
                        // If ctl is not contained by this, we start at the 
first child of this
                        if (!this.Contains(ctl)) {
                                ctl = null;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to