]> git.saurik.com Git - wxWidgets.git/commitdiff
also scroll vertically if necessary in MoveToItem() when the control is in a non...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Jan 2008 00:52:42 +0000 (00:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 3 Jan 2008 00:52:42 +0000 (00:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 7a63129ecdfa40806c58caaca9db24c0859673d2..3bb512deb5581f908b66de373fe6ef35245b414d 100644 (file)
@@ -3309,10 +3309,20 @@ void wxListMainWindow::MoveToItem(size_t item)
     }
     else // !report
     {
+        int sx = -1,
+            sy = -1;
+
         if (rect.x-view_x < 5)
-            Scroll( (rect.x - 5) / SCROLL_UNIT_X, -1 );
+            sx = (rect.x - 5) / SCROLL_UNIT_X;
         if (rect.x + rect.width - 5 > view_x + client_w)
-            Scroll( (rect.x + rect.width - client_w + SCROLL_UNIT_X) / SCROLL_UNIT_X, -1 );
+            sx = (rect.x + rect.width - client_w + SCROLL_UNIT_X) / SCROLL_UNIT_X;
+
+        if (rect.y-view_y < 5)
+            sy = (rect.y - 5) / hLine;
+        if (rect.y + rect.height - 5 > view_y + client_h)
+            sy = (rect.y + rect.height - client_h + hLine) / hLine;
+
+        Scroll(sx, sy);
     }
 }