I am writing a component that includes a TScrollBox. Into this ScrollBox I put several labels (TLabel). After inserting a Label I increase the position variables (CurrentX, CurrentY) to identify the position for the next label that may be inserted.
All this works fine if I do not scroll the client area of the ScrollBox.
If I scroll it e.g. downwards, the next label I insert will be placed incorrectly. CurrentX and CurrentY seem to be the absolute coordinates of the clientArea of the ScrollBox.
How can I convert them into logical coordinates to place the labels correctly, even if I scroll the field?