Wrong Coordinates when using TScaledLayout

  

I’m new to coding and Delphi, and so far I have been able to find answers to all my problems here but this recent one.

I want to have a project that will stretch to fit all Android/IOS screens if possible. I have set my ScaledLayout1 to align with the Form and everything works just fine when the screen is stretched, but when it starts using for example: Circle1.Position.X:= X ;, or anything involving the X and Y Coordinates like PtInRect(), .Point, .Position, .CenterPoint, .Width, .Height, … and so on, it reads them wrong and then nothing works onscreen as it should (For the example Circle1.Position.X:= X ; should make the Circle1 be on your mouse pointer but instead it is away from it for a certain lenght that gets bigger the more screen is stretched.

For that line I have a workaround, Circle1.Position.X:= ScaledX(X); where ScaledX() is a function that multiplies X with (OriginalWidth / Width) of the ScaledLayout1 and that seems to work, but does that mean that I need to make fixing functions for every single thing that uses coordinates? But that won’t make very much sense.

Am I doing something wrong? Or Is there something that I can use to convert the coordinates to fit the stretched screen resolution? Or is there a better way to detect interactions between objects?

Comments are closed.