Author: mkestner
Date: 2007-01-05 15:43:36 -0500 (Fri, 05 Jan 2007)
New Revision: 70558

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
Log:

2007-01-05  Mike Kestner  <[EMAIL PROTECTED]>

        * ListView.cs: hack to eliminate Lost/Got focus notifications on
        cycles between the ItemControl and parent.  Fixes #80388.


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-05 20:14:32 UTC (rev 70557)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-05 20:43:36 UTC (rev 70558)
@@ -1,3 +1,8 @@
+2007-01-05  Mike Kestner  <[EMAIL PROTECTED]>
+
+       * ListView.cs: hack to eliminate Lost/Got focus notifications on
+       cycles between the ItemControl and parent.  Fixes #80388.
+
 2007-01-05  Gert Driesen  <[EMAIL PROTECTED]>
 
        * Control.cs: Lazy init layout engine. Do not directly use 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-01-05 20:14:32 UTC (rev 70557)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs      
2007-01-05 20:43:36 UTC (rev 70558)
@@ -1871,8 +1871,13 @@
 
                        internal override void OnGotFocusInternal (EventArgs e)
                        {
-                               owner.Focus ();
+                               owner.Select (false, true);
                        }
+
+                       internal override void OnLostFocusInternal (EventArgs e)
+                       {
+                               owner.Select (false, true);
+                       }
                }
                
                internal class ListViewLabelEditTextBox : TextBox
@@ -2252,8 +2257,29 @@
                        // FIXME: TODO
                }
 
+               bool refocusing = false;
+
                protected override void WndProc (ref Message m)
                {
+                       switch ((Msg)m.Msg) {
+                       case Msg.WM_KILLFOCUS:
+                               Control receiver = Control.FromHandle 
(m.WParam);
+                               if (receiver == item_control) {
+                                       has_focus = false;
+                                       refocusing = true;
+                                       return;
+                               }
+                               break;
+                       case Msg.WM_SETFOCUS:
+                               if (refocusing) {
+                                       has_focus = true;
+                                       refocusing = false;
+                                       return;
+                               }
+                               break;
+                       default:
+                               break;
+                       }
                        base.WndProc (ref m);
                }
                #endregion // Protected Methods

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

Reply via email to