Author: ivanz
Date: 2008-01-22 10:14:59 -0500 (Tue, 22 Jan 2008)
New Revision: 93534

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
Log:
2008-01-22  Ivan N. Zlatev  <[EMAIL PROTECTED]>

         * PropertyGridView.cs: Fix focusing behavior:
         - Tab should focus the grid text box.
         - Clicking on the labels shouldn't focus the grid text box.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-01-22 15:08:39 UTC (rev 93533)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-01-22 15:14:59 UTC (rev 93534)
@@ -1,5 +1,11 @@
 2008-01-22  Ivan N. Zlatev  <[EMAIL PROTECTED]>
 
+        * PropertyGridView.cs: Fix focusing behavior:
+        - Tab should focus the grid text box.
+        - Clicking on the labels shouldn't focus the grid text box.
+
+2008-01-22  Ivan N. Zlatev  <[EMAIL PROTECTED]>
+
         * PropertyGridView.cs: IsValueTypeGridItem should return true 
         for Arrays as well.
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2008-01-22 15:08:39 UTC (rev 93533)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2008-01-22 15:14:59 UTC (rev 93534)
@@ -274,6 +274,8 @@
                                                        foundItem.Expanded = 
!foundItem.Expanded;
 
                                        this.property_grid.SelectedGridItem = 
foundItem;
+                                       if (!GridLabelHitTest (e.X))
+                                               FocusSelection ();
                                }
                                
                                base.OnMouseDown (e);
@@ -320,6 +322,11 @@
                        Select (this);
                }
 
+               private void FocusSelection ()
+               {
+                       Select (grid_textbox);
+               }
+
                protected override bool ProcessDialogKey (Keys keyData) {
                        GridItem selectedItem = property_grid.SelectedGridItem;
                        if (selectedItem != null
@@ -334,6 +341,9 @@
                                        grid_textbox.Text = 
selectedItem.PropertyDescriptor.Converter.ConvertToString(selectedItem.Value);
                                        UnfocusSelection ();
                                        return true;
+                               case Keys.Tab:
+                                       FocusSelection ();
+                                       return true;
                                default:
                                        return false;
                                }
@@ -556,6 +566,13 @@
                        }
                }
 
+               private bool GridLabelHitTest (int x)
+               {
+                       if (0 <= x && x <= splitter_percent * this.Width)
+                               return true;
+                       return false;
+               }
+
                private GridItem GetSelectedGridItem (GridItemCollection 
grid_items, int y, ref int current) {
                        foreach (GridItem child_grid_item in grid_items) {
                                if (y > current && y < current + row_height) {
@@ -1041,7 +1058,6 @@
                                                ClientRectangle.Width - xloc - 
(vbar.Visible ? vbar.Width : 0),
                                                row_height - 2);
                        grid_textbox.Visible = true;
-                       grid_textbox.Select ();
                        ResumeLayout (false);
                }
 

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

Reply via email to