diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index c1adbb0b24..b01c6b4e54 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -2218,6 +2218,10 @@ private: // SetColPos() and ResetColPos()) void RefreshAfterColPosChange(); + // reset the variables used during dragging operations after it ended + // because we lost mouse capture + void DoAfterDraggingEnd(); + // return the position (not index) of the column at the given logical pixel // position diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f5bd9466a5..c3ab7f0594 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3846,18 +3846,23 @@ void wxGrid::CancelMouseCapture() // cancel operation currently in progress, whatever it is if ( m_winCapture ) { - m_isDragging = false; - m_startDragPos = wxDefaultPosition; - - m_cursorMode = WXGRID_CURSOR_SELECT_CELL; - m_winCapture->SetCursor( *wxSTANDARD_CURSOR ); - m_winCapture = NULL; + DoAfterDraggingEnd(); // remove traces of whatever we drew on screen Refresh(); } } +void wxGrid::DoAfterDraggingEnd() +{ + m_isDragging = false; + m_startDragPos = wxDefaultPosition; + + m_cursorMode = WXGRID_CURSOR_SELECT_CELL; + m_winCapture->SetCursor( *wxSTANDARD_CURSOR ); + m_winCapture = NULL; +} + void wxGrid::ChangeCursorMode(CursorMode mode, wxWindow *win, bool captureMouse)