From 563d25babe10c4da61861146be3134ace61a3bf8 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 1 Jul 2006 16:43:54 +0000 Subject: [PATCH] Need to convert from physical to logical units inside HitTest git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextctrl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index b414fa7bb5..7503b9ece1 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -1627,8 +1627,12 @@ wxRichTextCtrl::HitTest(const wxPoint& pt, { wxClientDC dc((wxRichTextCtrl*) this); ((wxRichTextCtrl*)this)->PrepareDC(dc); + + // Buffer uses logical position (relative to start of buffer) + // so convert + wxPoint pt2 = GetLogicalPoint(pt); - int hit = ((wxRichTextCtrl*)this)->GetBuffer().HitTest(dc, pt, *pos); + int hit = ((wxRichTextCtrl*)this)->GetBuffer().HitTest(dc, pt2, *pos); switch ( hit ) { @@ -2017,10 +2021,10 @@ bool wxRichTextCtrl::CanRedo() const } // ---------------------------------------------------------------------------- -// implemenation details +// implementation details // ---------------------------------------------------------------------------- -void wxRichTextCtrl::Command(wxCommandEvent & event) +void wxRichTextCtrl::Command(wxCommandEvent& event) { SetValue(event.GetString()); GetEventHandler()->ProcessEvent(event); -- 2.45.2