I am developing an application for Windows/Apple with Delphi 10 and Firemonkey.
My main form has a TButton.
When I press the TButton I would like to create and positioning Form1 exactly under the TButton.
Here there is my code:
//Transposes the coordinates in the context of the form.
myTPointF := TButton.LocalToAbsolute(TButton.Position.Point);
//Transposes the coordinates in the context of the screen.
myTPointF := ClientToScreen(myTPointF);
Form1.Top := FloatToStr(myTPointF.X) + Round(TButton.Height);
Form1.Left := FloatToStr(myTPointF.Y);
And if the TButton is near the Point(0,0) of the form (not the screen) it works, but the more is away from this point the more Form1 is wrong when i open it.
Link for the image:
Thanks in advance for the help.