2006-10-06 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Fri, 6 Oct 2006 17:27:04 +0000 (17:27 -0000)
committerChris Toshok <toshok@novell.com>
Fri, 6 Oct 2006 17:27:04 +0000 (17:27 -0000)
* Splitter.cs: doh, fix splitters that don't want to cancel the
movement when you drag them.  Also, impose the limits on the
values we send to the SplitterMovingEvent.  Fixes #79598.

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

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

index 85d2657c86db7372b46a9d671d6222cb346dc596..faba2a353896235d22e9bf557c9bbe151f76da22 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-06  Chris Toshok  <toshok@ximian.com>
+
+       * Splitter.cs: doh, fix splitters that don't want to cancel the
+       movement when you drag them.  Also, impose the limits on the
+       values we send to the SplitterMovingEvent.  Fixes #79598.
+
 2006-10-06  Jackson Harper  <jackson@ximian.com>
 
        * TextBoxBase.cs: Ignore whether or not the scrollbar is enabled,
index d4acf87b7731b400283463815302faf7ed76a19c..1a71b58d9af3db87ddd62dd16bf29b9c441f4271 100644 (file)
@@ -458,26 +458,23 @@ namespace System.Windows.Forms {
                        // Grab our new coordinates
                        prev_split_position = split_position;
 
-                       // Prepare the event
-                       if (horizontal) {
-                               sevent.split_x = 0;
-                               sevent.split_y = split_position;
-                       } else {
-                               sevent.split_x = split_position;
-                               sevent.split_y = 0;
-                       }
+                       int candidate = horizontal ? pt.Y : pt.X;
+
+                       // Enforce limit on what we send to the event
+                       if (candidate < limit_min)
+                               candidate = limit_min;
+                       else if (candidate > limit_max)
+                               candidate = limit_max;
 
                        sevent.x = pt.X;
                        sevent.y = pt.Y;
+                       sevent.split_x = horizontal ? 0 : candidate;
+                       sevent.split_y = horizontal ? candidate : 0;
 
                        // Fire the event
                        OnSplitterMoving(sevent);
 
-                       if (horizontal) {
-                               split_position = sevent.split_y;
-                       } else {
-                               split_position = sevent.split_x;
-                       }
+                       split_position = horizontal ? sevent.split_y : sevent.split_x;
 
                        // Enforce limits
                        if (split_position < limit_min) {