[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Controls' (#lcl)

TControl.ClientToParent

Converts the screen coordinates for the control to the screen coordinates for the specified parent control.

Declaration

Source position: controls.pp line 1669

public function TControl.ClientToParent(

  const Point: TPoint;

  AParent: TWinControl = Nil

):TPoint;

Arguments

Point

  

TPoint instance with the client coordinates for the control.

AParent

  

Parent control with the bounds for the adjusted coordinates.

Function result

TPoint instance with the client coordinates adjusted to the parent control.

Description

ClientToParent is a TPoint function used to convert the screen coordinates for the control to the screen coordinates for the specified parent control. If Aparent is unassigned, the Parent property for the control is used in the method.

ClientToParent calls the IsParentOf method in AParent to determine if control is in its control hierarchy. An EInvalidOperation exception is raised if the return value from IsParentOf is False.

The return value is determined by converting the client coordinates for the control to screen coordinates, and asking the parent control to convert them back to the client coordinates for the parent control.

ClientToParent is used, for instance, in the TScrollingWinControl.ScrollInView method.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.