From 04a33b503114fa4b1d8b96f5c8c31a545a18da6e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 8 Dec 2008 11:37:42 +0000 Subject: [PATCH] account for scroll offset correctly in the mouse event handler git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/headerctrlg.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generic/headerctrlg.cpp b/src/generic/headerctrlg.cpp index 072159590e..54d7cace41 100644 --- a/src/generic/headerctrlg.cpp +++ b/src/generic/headerctrlg.cpp @@ -134,7 +134,7 @@ int wxHeaderCtrl::GetColStart(unsigned int idx) const { wxHeaderCtrl * const self = const_cast(this); - int pos = 0; + int pos = m_scrollOffset; for ( unsigned n = 0; n < idx; n++ ) { const wxHeaderColumnBase& col = self->GetColumn(n); @@ -287,11 +287,14 @@ void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent) { mevent.Skip(); + // account for the control displacement + const int x = mevent.GetX() - m_scrollOffset; + // find if the event is over a column at all bool onSeparator; const unsigned col = mevent.Leaving() ? (onSeparator = false, COL_NONE) - : FindColumnAtPos(mevent.GetX(), onSeparator); + : FindColumnAtPos(x, onSeparator); // update the highlighted column if it changed if ( col != m_hover ) -- 2.45.2