From 4efbeff4a5aefd3fd7f482a5ff4b3bd74a25b685 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 2 Mar 2013 12:11:36 +0000 Subject: [PATCH] Interpret wxRect passed to wxRichToolTip::ShowFor() as client coords. It makes more sense to use the window coordinates here instead of the screen ones. Closes #15060. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/richtooltip.h | 2 ++ src/generic/richtooltipg.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/wx/richtooltip.h b/interface/wx/richtooltip.h index 205ba26..62f6c4f 100644 --- a/interface/wx/richtooltip.h +++ b/interface/wx/richtooltip.h @@ -182,6 +182,8 @@ public: window which must be non-@NULL or, if @a rect is non-@NULL, the middle of the specified wxRect. + The coordinates of the @a rect parameter are relative to the given window. + Currently the native MSW implementation is used only if @a win is a wxTextCtrl and @a rect is @NULL. This limitation may be removed in the future. diff --git a/src/generic/richtooltipg.cpp b/src/generic/richtooltipg.cpp index 0c00e24..5d08e12 100644 --- a/src/generic/richtooltipg.cpp +++ b/src/generic/richtooltipg.cpp @@ -239,7 +239,7 @@ public: if ( !rect || rect->IsEmpty() ) pos = GetTipPoint(); else - pos = wxPoint( rect->x + rect->width / 2, rect->y + rect->height / 2 ); + pos = GetParent()->ClientToScreen( wxPoint( rect->x + rect->width / 2, rect->y + rect->height / 2 ) ); // We want our anchor point to coincide with this position so offset // the position of the top left corner passed to Move() accordingly. -- 2.7.4