From f4f4c3aca4e219caba09091624c7a72cc66c354c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Feb 2013 13:48:20 +0000 Subject: [PATCH] Fix off by 1 error in wxGenericListCtrl::HitTest(). Account for the header height if the header is present. Closes #15063. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/listctrl.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 2a24661..e8aa774 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -621,6 +621,7 @@ All (GUI): - Add wxMask::GetBitmap() for wxMSW, wxGTK and wxOSX - Add wxCheckListBox::GetCheckedItems() (hartwigw). - Add wxAUI_TB_PLAIN_BACKGROUND wxAuiToolBar style (Allann Jones). +- Fix off by 1 error in wxGenericListCtrl::HitTest() (Daniel Hyams). wxGTK: diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b311e03..caebe00 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4144,6 +4144,10 @@ long wxListMainWindow::HitTest( int x, int y, int &flags ) const if ( InReportView() ) { + // Account for the header height if it's present. + if ( HasHeader() ) + y -= GetListCtrl()->m_headerWin->GetSize().y + 1; + size_t current = y / GetLineHeight(); if ( current < count ) { -- 2.7.4