From: Vadim Zeitlin Date: Thu, 3 Jan 2008 00:52:42 +0000 (+0000) Subject: also scroll vertically if necessary in MoveToItem() when the control is in a non... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e81fa3850e1fc0e24e02186333d6cd990a609bb4 also scroll vertically if necessary in MoveToItem() when the control is in a non-report mode (based on patch 1857650) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 7a63129ecd..3bb512deb5 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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); } }