Author: andreia
Date: 2007-01-11 12:58:42 -0500 (Thu, 11 Jan 2007)
New Revision: 70869

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
Log:
* ContainerControl.cs: Remove ContainerSelected flag, not needed
anymore.

* Control.cs (Controls.Add): Check if control to be added to the collection
is a top level control, and throw an ArgumentException if it is.
Remove ContainerSelectedFlag, not needed anymore.

* XplaUIWin32.cs (SetTopMost): Add flag SWP_NOACTIVATE so that setting the
top most control doesn't activate the form. This fixes a problem in the
MessageBox, where the default button wouldn't get focus because the form
was activated before being Loaded - when the Owner is set, SetTopMost is
called, and it would activate it.

2007-01-11  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-01-11 17:53:57 UTC (rev 70868)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-11 17:58:42 UTC (rev 70869)
@@ -1,3 +1,18 @@
+2007-01-11  Andreia Gaita  <[EMAIL PROTECTED]>
+
+       * ContainerControl.cs: Remove ContainerSelected flag, not needed
+       anymore.
+
+       * Control.cs (Controls.Add): Check if control to be added to the 
collection
+       is a top level control, and throw an ArgumentException if it is.
+       Remove ContainerSelectedFlag, not needed anymore.
+
+       * XplaUIWin32.cs (SetTopMost): Add flag SWP_NOACTIVATE so that setting 
the
+       top most control doesn't activate the form. This fixes a problem in the
+       MessageBox, where the default button wouldn't get focus because the form
+       was activated before being Loaded - when the Owner is set, SetTopMost is
+       called, and it would activate it.
+
 2007-01-11  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * Button.cs: When clicked and setting the parent form's DialogResult,

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs  
    2007-01-11 17:53:57 UTC (rev 70868)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs  
    2007-01-11 17:58:42 UTC (rev 70869)
@@ -478,10 +478,7 @@
                        if (Parent != null) {
                                IContainerControl parent = 
Parent.GetContainerControl ();
                                if (parent != null) {
-                                       if (!(directed && auto_select_child))
-                                               ContainerSelected = true;
-                                       if (!(this.Parent.ContainerSelected))
-                                               parent.ActiveControl = this;
+                                       parent.ActiveControl = this;
                                }
                        }
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-01-11 17:53:57 UTC (rev 70868)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-01-11 17:58:42 UTC (rev 70869)
@@ -881,6 +881,10 @@
                                        throw new ArgumentException("Object of 
type Control required", "value");
                                }
 
+                               if (((Control)value).GetTopLevel()) {
+                                       throw new ArgumentException("Cannot add 
a top level control to a control.", "value");
+                               }
+
                                return list.Add(value);
                        }
 
@@ -2168,11 +2172,6 @@
                        }
                }
 
-               internal bool ContainerSelected {
-                       get { return container_selected; }
-                       set { container_selected = value; }
-               }
-
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                [Browsable(false)]
                
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
@@ -3601,15 +3600,6 @@
 #endif
 
                public void Select() {
-                       if (this is ContainerControl)
-                               ContainerSelected = true;
-                       else {
-                               Control c = this.Parent;
-                               while (c != null) {
-                                       c.ContainerSelected = false;
-                                       c = c.Parent;
-                               }
-                       }
                        Select(false, false);   
                }
 
@@ -4117,8 +4107,7 @@
                        
                        container = GetContainerControl();
                        if (container != null && (Control)container != this)
-                               if (!this.Parent.ContainerSelected)
-                                       container.ActiveControl = this;
+                           container.ActiveControl = this;
                }
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]
@@ -4709,8 +4698,6 @@
 
                        case Msg.WM_SETFOCUS: {
                                if (!has_focus) {                
-                                       if (this.Parent != null && 
this.Parent.ContainerSelected)
-                                               return;
                                        this.has_focus = true;
                                        OnGotFocusInternal (EventArgs.Empty);
                                }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2007-01-11 17:53:57 UTC (rev 70868)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2007-01-11 17:58:42 UTC (rev 70869)
@@ -1659,10 +1659,10 @@
 
                internal override bool SetTopmost(IntPtr hWnd, IntPtr 
hWndOwner, bool Enabled) {
                        if (Enabled) {
-                               Win32SetWindowPos(hWnd, 
SetWindowPosZOrder.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | 
SetWindowPosFlags.SWP_NOSIZE);
+                               Win32SetWindowPos(hWnd, 
SetWindowPosZOrder.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | 
SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
                                return true;
                        } else {
-                               Win32SetWindowPos(hWnd, 
SetWindowPosZOrder.HWND_NOTOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | 
SetWindowPosFlags.SWP_NOSIZE);
+                               Win32SetWindowPos(hWnd, 
SetWindowPosZOrder.HWND_NOTOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | 
SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
                                return true;
                        }
                }

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

Reply via email to