From a2d954469d61afd45f46d5e3f0d1cf845a504280 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 8 Oct 2007 22:28:33 +0000 Subject: [PATCH] On Mac the first visible line needs to be recalculated after the Scroll because it can be set to the wrong value in Scroll because of the paint event generated by the Update() there. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@49093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 0b6115e817..747d3a0d60 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3297,6 +3297,17 @@ void wxListMainWindow::MoveToItem(size_t item) Scroll( -1, rect.y / hLine ); if (rect.y + rect.height + 5 > view_y + client_h) Scroll( -1, (rect.y + rect.height - client_h + hLine) / hLine ); + +#ifdef __WXMAC__ + // At least on Mac the visible lines value will get reset inside of + // Scroll *before* it actually scrolls the window because of the + // Update() that happens there, so it will still have the wrong value. + // So let's reset it again and wait for it to be recalculated in the + // next paint event. I would expect this problem to show up in wxGTK + // too but couldn't duplicate it there. Perhaps the order of events + // is different... --Robin + ResetVisibleLinesRange(); +#endif } else // !report {