Author: andreia
Date: 2006-11-07 21:59:15 -0500 (Tue, 07 Nov 2006)
New Revision: 67507

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 : Focus() now calls Select to set the Container's
Active Control and to give it focus. To avoid infinite recursion
(because ActiveControl also calls Focus at one point), a check 
is made in Focus with the help of a new internal variable
is_focusing.

2006-11-07  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        
2006-11-08 01:14:58 UTC (rev 67506)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-08 02:59:15 UTC (rev 67507)
@@ -1,3 +1,11 @@
+2006-11-07  Andreia Gaita  <[EMAIL PROTECTED]>
+
+       * Control.cs : Focus() now calls Select to set the Container's
+       Active Control and to give it focus. To avoid infinite recursion
+       (because ActiveControl also calls Focus at one point), a check 
+       is made in Focus with the help of a new internal variable
+       is_focusing.
+
 2006-11-07  Mike Kestner  <[EMAIL PROTECTED]>
 
        * ListView.cs : raise OnSelectedIndexChanged in CreateHandle

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-11-08 01:14:58 UTC (rev 67506)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-11-08 02:59:15 UTC (rev 67507)
@@ -75,6 +75,7 @@
                internal bool                   is_toplevel;            // 
tracks if the control is a toplevel window
                internal bool                   is_recreating;          // 
tracks if the handle for the control is being recreated
                internal bool                   causes_validation;      // 
tracks if validation is executed on changes
+               internal bool                   is_focusing;            // 
tracks if Focus has been called on the control and has not yet finished
                internal int                    tab_index;              // 
position in tab order of siblings
                internal bool                   tab_stop = true;        // is 
the control a tab stop?
                internal bool                   is_disposed;            // has 
the window already been disposed?
@@ -2782,8 +2783,10 @@
                }
 
                public bool Focus() {
-                       if (CanFocus && IsHandleCreated && !has_focus) {
-                               XplatUI.SetFocus(this.window.Handle);
+                       if (CanFocus && IsHandleCreated && !has_focus && 
!is_focusing) {
+                               is_focusing = true;
+                               Select(this);
+                               is_focusing = false;
                        }
                        return has_focus;
                }

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

Reply via email to