2008-04-05 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Sat, 5 Apr 2008 13:23:53 +0000 (13:23 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Sat, 5 Apr 2008 13:23:53 +0000 (13:23 -0000)
* PropertyGridView.cs: Fix expansion via [+] misbehavior on
double-click. It expanded it once in the mouse down and then
again in the double-click handler.

svn path=/trunk/mcs/; revision=99903

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs

index 0cac42a00d50be1bb0e4707871962896e33feffd..13965d57b6e735480eb781f6ba262bb468234bf0 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-05  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * PropertyGridView.cs: Fix expansion via [+] misbehavior on 
+       double-click. It expanded it once in the mouse down and then 
+       again in the double-click handler.
+
 2008-04-04  Ivan N. Zlatev  <contact@i-nz.net>
        
        * GridEntry.cs: ICustomTypeDescriptor support for PropertyOwner, 
index 80a91df046f57e22408fadc8ffda8eb610a763b3..8c0366742ac7216ea2cfb15365c183e8fb96e15b 100644 (file)
@@ -1,3 +1,4 @@
+
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
@@ -61,6 +62,7 @@ namespace System.Windows.Forms.PropertyGridInternal {
                private Font bold_font;
                private Brush inactive_text_brush;
                private ListBox dropdown_list;
+               private Point last_click;
 #if NET_2_0
                private Padding dropdown_form_padding;
 #endif
@@ -163,9 +165,13 @@ namespace System.Windows.Forms.PropertyGridInternal {
                        }
                }
 
+               // [+] expanding is handled in OnMouseDown, so in order to prevent 
+               // duplicate expanding ignore it here.
+               // 
                protected override void OnDoubleClick (EventArgs e) 
                {
-                       if (this.SelectedGridItem != null && this.SelectedGridItem.Expandable)
+                       if (this.SelectedGridItem != null && this.SelectedGridItem.Expandable && 
+                           !this.SelectedGridItem.PlusMinusBounds.Contains (last_click))
                                this.SelectedGridItem.Expanded = !this.SelectedGridItem.Expanded;
                        else
                                ToggleValue (this.SelectedGridItem);
@@ -213,6 +219,7 @@ namespace System.Windows.Forms.PropertyGridInternal {
                protected override void OnMouseDown (MouseEventArgs e) 
                {
                        base.OnMouseDown (e);
+                       last_click = e.Location;
                        if (this.RootGridItem == null)
                                return;