Author: andreia
Date: 2007-12-06 18:33:06 -0500 (Thu, 06 Dec 2007)
New Revision: 90873

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
Log:
* Control.cs: When removing controls, get the actual container
to notify about active control changes. Fixes 341314.

2007-12-06  Andreia Gaita <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-12-06 23:17:43 UTC (rev 90872)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-12-06 23:33:06 UTC (rev 90873)
@@ -1,3 +1,8 @@
+2007-12-06  Andreia Gaita <[EMAIL PROTECTED]>
+
+       * Control.cs: When removing controls, get the actual container
+       to notify about active control changes. Fixes 341314.
+
 2007-12-06  Carlos Alberto Cortez <[EMAIL PROTECTED]>
 
        * ListViewItem.cs: Forgot to add Font to our serialization stuff.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-12-06 23:17:43 UTC (rev 90872)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-12-06 23:33:06 UTC (rev 90873)
@@ -793,7 +793,7 @@
                                owner.PerformLayout(value, "Parent");
                                owner.OnControlRemoved(new 
ControlEventArgs(value));
 
-                               ContainerControl container = owner as 
ContainerControl;
+                               ContainerControl container = 
owner.InternalGetContainerControl ();
                                if (container != null) { 
                                        // Inform any container controls about 
the loss of a child control
                                        // so that they can update their active 
control
@@ -3718,6 +3718,18 @@
                        return null;
                }
 
+               internal ContainerControl InternalGetContainerControl() {
+                       Control current = this;
+
+                       while (current!=null) {
+                               if ((current is ContainerControl) && 
((current.control_style & ControlStyles.ContainerControl)!=0)) {
+                                       return current as ContainerControl;
+                               }
+                               current = current.parent;
+                       }
+                       return null;
+               }
+
                public Control GetNextControl(Control ctl, bool forward) {
 
                        if (!this.Contains(ctl)) {
@@ -4107,6 +4119,9 @@
                                        break;
                                }
 
+#if DebugFocus
+                               Console.WriteLine("{0} {1}", c, c.CanSelect);
+#endif
                                if (c.CanSelect && ((c.parent == this) || 
nested) && (c.tab_stop || !tabStopOnly)) {
                                        c.Select (true, true);
                                        return true;

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

Reply via email to