Author: andreia
Date: 2006-10-20 18:04:17 -0400 (Fri, 20 Oct 2006)
New Revision: 66846

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
   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/Form.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs
Log:
2006-10-20 Andreia Gaita <[EMAIL PROTECTED]>
        Fixes #79384, #79394, #79652, #79667
        * Application.cs: 
        
        - Modal windows are now destroyed in the proper order for windows
        
        * ContainerControl.cs:
        
        - ActiveControl setter has more conditions on when to return:
                - if we're reselecting the active control, but it actually
                didn't have focus (window hidden or some such), it runs
                - if the active control being selected doesn't actually 
                exist in the container, it returns
        
        * Form.cs
        
        - The ShowDialog now gets the current form as the owner when
        invoking without parameters, and correctly activates the owner 
        when returning
        
        * MessageBox.cs
        
        - MessageBox now catches the Escape key to exit


Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs   
2006-10-20 21:58:43 UTC (rev 66845)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs   
2006-10-20 22:04:17 UTC (rev 66846)
@@ -551,8 +551,7 @@
                        if (Modal) {
                                Control c;
 
-                               context.MainForm.Hide();
-                               context.MainForm.is_modal = false;
+                               Control old = context.MainForm;
 
                                while (toplevels.Count>0) {
                                        #if DebugRunLoop
@@ -561,6 +560,7 @@
                                        c = (Control)toplevels.Dequeue();
                                        if (c.IsHandleCreated) {
                                                
XplatUI.EnableWindow(c.window.Handle, true);
+                                               
Application.MWFThread.Current.Context.MainForm = (Form)c;
                                        }
                                }
                                #if DebugRunLoop
@@ -572,6 +572,7 @@
                                #if DebugRunLoop
                                        Console.WriteLine("   Done with the 
SetModal");
                                #endif
+                               old.Dispose();
                        }
 
                        #if DebugRunLoop

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-20 21:58:43 UTC (rev 66845)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-20 22:04:17 UTC (rev 66846)
@@ -1,3 +1,27 @@
+2006-10-20 Andreia Gaita <[EMAIL PROTECTED]>
+       Fixes #79384, #79394, #79652, #79667
+       * Application.cs: 
+       
+       - Modal windows are now destroyed in the proper order for windows
+       
+       * ContainerControl.cs:
+       
+       - ActiveControl setter has more conditions on when to return:
+               - if we're reselecting the active control, but it actually
+               didn't have focus (window hidden or some such), it runs
+               - if the active control being selected doesn't actually 
+               exist in the container, it returns
+       
+       * Form.cs
+       
+       - The ShowDialog now gets the current form as the owner when
+       invoking without parameters, and correctly activates the owner 
+       when returning
+       
+       * MessageBox.cs
+       
+       - MessageBox now catches the Escape key to exit
+
 2006-10-20  Chris Toshok  <[EMAIL PROTECTED]>
 
        * PropertyGridView.cs: fix a number of issues (bug #78565, and

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs  
    2006-10-20 21:58:43 UTC (rev 66845)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs  
    2006-10-20 22:04:17 UTC (rev 66846)
@@ -68,7 +68,7 @@
                        }
 
                        set {
-                               if ((active_control==value) || (value==null)) {
+                               if (value==null || (active_control == value && 
active_control.has_focus) || !this.child_controls.Contains(value)) {
                                        return;
                                }
 
@@ -377,7 +377,7 @@
                                c = GetNextControl(c, true);
                                if (c != null) {
                                        // This is stupid. I want to be able to 
call c.ProcessMnemonic directly
-                                       if (c.ProcessControlMnemonic(charCode)) 
{
+                                       if (c.CanSelect && 
c.ProcessControlMnemonic(charCode)) {
                                                return(true);
                                        }
                                        continue;
@@ -422,14 +422,12 @@
                                        mouse_clicks, LowOrder ((int) 
m.LParam.ToInt32 ()),
                                        HighOrder ((int) m.LParam.ToInt32 ()), 
0));
                                return;
-                               /*
                        case Msg.WM_SETFOCUS:
                                if (active_control != null)
                                        Select (active_control);
                                else
                                        SelectNextControl (null, true, true, 
true, false);
                                break;
-                               */
                        case Msg.WM_KILLFOCUS:
                                break;
                        }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-10-20 21:58:43 UTC (rev 66845)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-10-20 22:04:17 UTC (rev 66846)
@@ -1199,11 +1199,10 @@
                }
 
                public DialogResult ShowDialog() {
-                       return ShowDialog(null);
+                       return ShowDialog(this.owner);
                }
 
                public DialogResult ShowDialog(IWin32Window ownerWin32) {
-                       Form            previous;
                        Rectangle       area;
                        bool            confined;
                        IntPtr          capture_window;
@@ -1247,8 +1246,6 @@
                                XplatUI.UngrabWindow(capture_window);
                        }
 
-                       previous = Form.ActiveForm;
-
 #if not
                        // Commented out; we instead let the Visible=true 
inside the runloop create the control
                        // otherwise setting DialogResult inside any of the 
events that are triggered by the
@@ -1262,9 +1259,9 @@
 
                        Application.RunLoop(true, new ApplicationContext(this));
 
-                       if (previous != null) {
+                       if (owner != null) {
                                // Cannot use Activate(), it has a check for 
the current active window...
-                               XplatUI.Activate(previous.window.Handle);
+                               XplatUI.Activate(owner.window.Handle);
                        }
 
                        if (DialogResult != DialogResult.None) {

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs    
2006-10-20 21:58:43 UTC (rev 66845)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs    
2006-10-20 22:04:17 UTC (rev 66846)
@@ -253,6 +253,16 @@
                                }
 
                        }
+
+                       protected override bool ProcessDialogKey(Keys keyData) {
+                               if (keyData == Keys.Escape) {
+                                       this.CancelClick(this, null);
+                                       return true;
+                               }
+
+                               return base.ProcessDialogKey (keyData);
+                       }
+
                        #endregion      // MessageBoxForm Methods
 
                        #region Functions for Adding buttons

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

Reply via email to