What is the replacement of Component::globalPositionToRelative(int& x, int& y) in newest JUCE?

Im doing migration work from 1.46 to 7.05 . I have usage of Component::globalPositionToRelative in 1.46 code. I replaced globalPositionToRelative with getLocalPoint(source, point) but i got wrong positions. What is the correct way to position a window relative to other ?

i personally do it by having a reference to the lowest editor around. make sure not to confuse it with getting the lowest component in the hierarchy as that can be a different one in case of plugin wrappers, like the one in the standalone build. i noticed that when i was surprised about elements shifting lower after deactivating audio inputs, since that spawns that little message on top in the plugin wrapper

Assuming you have your global position stored in a Point like this:

juce::Point <int> globalPosition (x, y);

then you can obtain the position relative to a Component* c like this:

juce::Point <int> relativePosition = c->getLocalPoint (nullptr, globalPosition);
1 Like