2209-01-21 Carlos Alberto Cortez <calberto.cortez@gmail.com>
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Wed, 21 Jan 2009 21:20:53 +0000 (21:20 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Wed, 21 Jan 2009 21:20:53 +0000 (21:20 -0000)
* TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
of trying to set as top node the highest parent of the previous top
node. Moving to the bottom of the TreeView after a call to CollapseAll
is exactly what .net does. This should avoid some nasty issue when
CollapseAll is called and we don't need the vertical scroll bar.

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

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

index abe2b38379588c6c251ca7e500f1220c5edddcd3..88b04e05a56965c1b3e718261d86c0ceefccaadd 100644 (file)
@@ -1,3 +1,11 @@
+2209-01-21  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * TreeView.cs: In CollapseAll, set vbar to the maximum value, instead
+       of trying to set as top node the highest parent of the previous top
+       node. Moving to the bottom of the TreeView after a call to CollapseAll
+       is exactly what .net does. This should avoid some nasty issue when
+       CollapseAll is called and we don't need the vertical scroll bar.
+
 2009-01-21  Mario Carrion <mcarrion@novell.com>
 
        * Form.cs: UIA Support: Internal events added: UIAWindowStateChanged
index f5b442302002132cd5f86e02186f5205e4fa3f45..24359c3613e5964aacf90a88376d9003efd13ced 100644 (file)
@@ -806,19 +806,12 @@ namespace System.Windows.Forms {
                
                public void CollapseAll ()
                {
-                       TreeNode walk = TopNode;
-                       
-                       if (walk == null)
-                               return;
-                               
-                       while (walk.parent != root_node)
-                               walk = walk.parent;
-
                        BeginUpdate ();
                        root_node.CollapseAll ();
                        EndUpdate ();
 
-                       SetTop (walk);
+                       if (vbar.VisibleInternal)
+                               vbar.Value = vbar.Maximum - VisibleCount + 1;
                }
 
                public TreeNode GetNodeAt (Point pt) {