From 67a7abf778c836065dfd6532fd00831c1c9ccd3a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 14 Apr 1999 14:58:17 +0000 Subject: [PATCH] HitTest() now works when the ctrl is scrolled too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectrl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index 4602d32e83..804148c710 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -1444,8 +1444,13 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event ) wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& WXUNUSED(flags)) { + wxClientDC dc(this); + PrepareDC(dc); + long x = dc.DeviceToLogicalX( (long)point.x ); + long y = dc.DeviceToLogicalY( (long)point.y ); + bool onButton = FALSE; - return m_anchor->HitTest( point, onButton ); + return m_anchor->HitTest( wxPoint(x, y), onButton ); } void wxTreeCtrl::OnMouse( wxMouseEvent &event )