[bug] getScreenPosition() returns incorrect value!

#1

The Component::getScreenPosition() method seems to be returning the wrong value - instead it is returning the component’s position relative to the window, not the screen.

As you can see, getScreenPosition() is returning { 10, 10 } when infact it should return { 670, 330 }.
This is with the latest commit on the develop branch.

0 Likes

#2

The first setSize call in your constructor calls resized() of your MainComponent before it is added to the desktop.
What does a DBG show, after the window is actually on the desktop? Still 10, 10?

0 Likes

#3

Ahh, no you’re right - the screen position is correctly displayed after that initial resized().

Didn’t know about resized being called before the component is added to the desktop - that’s a useful tip!

0 Likes