From 8d2f00f251ab8dc39ad0cce83fbb3bfb6340d570 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 17 Feb 2011 15:01:48 +0000 Subject: [PATCH] Workaround for #10040: wxGrid scrolls back to the previous edit position git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 22208938ca..45630d4e3d 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -8636,6 +8636,11 @@ void wxGrid::ShowCellEditControl() editor->GetControl()->GetPosition().y ); editor->Show( true, attr ); +#ifdef __WXGTK20__ + int px, py; + GetViewStart(& px, & py); +#endif + // recalc dimensions in case we need to // expand the scrolled window to account for editor CalcDimensions(); @@ -8645,6 +8650,14 @@ void wxGrid::ShowCellEditControl() editor->DecRef(); attr->DecRef(); + +#ifdef __WXGTK20__ + // On GTK+, erroneous scrolling to the old control + // position can happen when the grid window gets a + // focus event and this is processed by wxScrollHelper. + // This line resets the scroll position. + Scroll(px, py); +#endif } } }