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

# TControl.ClientToParent

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

## Declaration

Source position: controls.pp line 1738

`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 client-relative coordinates specified in Point to the screen coordinates for the parent control in AParent. If AParent is unassigned (Nil), the Parent property for the control is used in the method.

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

ClientToParent calls ClientToScreen to get the absolute screen coordinates for the values in Point. The return value is the TPoint instance returned by converting the client coordinates to screen coordinates, and asking the parent control to convert the values back to client-relative coordinates for the parent control.

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