diff --git a/docs/changes.txt b/docs/changes.txt index df81f930fb..5969f3b391 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -107,6 +107,7 @@ All (GUI): - Add wxEVT_STC_AUTOCOMP_COMPLETED event (NewPagodi). - Fix retrieving bounding box for wxDC with transformed coordinates. - Fix wxGraphicsMatrixData::Concat() for Direct2D and Cairo renderers. +- Fix calculating point position in wxDataViewCtrl::HitTest(). wxGTK: diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index e68a589097..7517edea55 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1485,7 +1485,9 @@ public: bool HasSelection() const; /** - Hittest. + Retrieves item and column at the given point. + The point coordinates are specified in wxDataViewCtrl client area + coordinates. */ virtual void HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& col) const; @@ -2398,8 +2400,7 @@ public: const wxDataViewItem & item, unsigned int col); - - /** +/** Override this to render the cell. Before this is called, wxDataViewRenderer::SetValue was called so that this instance knows what to render. diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 860de73a4f..d35af10b3b 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -5340,7 +5340,10 @@ void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataVie void wxDataViewCtrl::HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column ) const { - m_clientArea->HitTest(point, item, column); + // Convert from wxDataViewCtrl coordinates to wxDataViewMainWindow coordinates. + // (They can be different due to the presence of the header.). + const wxPoint clientPt = m_clientArea->ScreenToClient(ClientToScreen(point)); + m_clientArea->HitTest(clientPt, item, column); } wxRect wxDataViewCtrl::GetItemRect( const wxDataViewItem & item,