wxWindow::GetRect() coordinate system?

8 views
Skip to first unread message

wsu

unread,
1:08 AM (8 hours ago) 1:08 AM
to wx-dev
When I was working on the implementation of the wxScrolled<> autoscroll, my experience with the drawing sample seemed to show that the coordinate system was client points.  However, today I used GetRect() on the dnd sample DnDShapeFrame, and it appears to be reporting GetRect() with screen coordinates.

Am I correct to think that windows for which wxWindow::IsTopLevel() is true report GetRect() with screen coordinates, but if wxWindow::IsTopLevel() is false, GetRect() returns client coordinates?  If so, then there is a bug in the new wxScrollHelperBase::AutoscrollTest().

Vadim Zeitlin

unread,
7:45 AM (1 hour ago) 7:45 AM
to wx-...@googlegroups.com
On Sat, 21 Feb 2026 22:08:10 -0800 (PST) 'wsu' via wx-dev wrote:

w> Am I correct to think that windows for which wxWindow::IsTopLevel() is true
w> report GetRect() with screen coordinates, but if wxWindow::IsTopLevel() is
w> false, GetRect() returns client coordinates?

GetRect() reports coordinates in the "outer" window coordinates system
(which is not quite the same as "parent" because TLWs may have parents, but
their outer window is always the entire screen), so yes, this is correct:
for TLWs you get screen coordinates (what else?) and for child windows you
get coordinates in their parent window.

w> If so, then there is a bug in the new
w> wxScrollHelperBase::AutoscrollTest().

I'm not sure what exactly the problem is (and I've completely missed it
when testing in any case), but please make a PR correcting it then.

TIA,
VZ
Reply all
Reply to author
Forward
0 new messages