I want to get the Left,Top coordinates of a control regarding to the container form. The target control may be, at the same time, inside of any number of other containers such as TPanels and TGroupBoxes. That means that to get the target control origin, the code should have to take into account the Left,Top coordinates of all the other containers + the Left,Top coordinates of the target control itself. Instead, I'm using a second approuch, wich consist in using the ClientToScreen function to get the Left,Top screen coordinates of the target control and after that, subtracting the Left,Top coordinates of the form. Saddly this approach is not working. I'm attaching an image that clarifies my thinkings and has the actual code I used to calculate the desired coordinates. I appreciate any help on this.
Try using ClientToParent and specify form as Parent
parameter.
You have to pass coords relative to control, so Top, Left of the control will be at control's (0,0)
Control.ClientToParent(TPoint.Create(0,0), Form)