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

# GetFirstParentForm

Performs a recursive search for the first Parent of type TCustomForm.

## Declaration

Source position: forms.pp line 1970

`function GetFirstParentForm(`
`Control: TControl`
`):TCustomForm;`

## Arguments

`Control` |  | TControl instance where the search for a parent form is started.

## Function result

The first custom form instance found by ascending the control hierarchy.

## Description

GetFirstParentForm is a TCustomForm function used to find the first form instance in the Parents for the specified Control. GetFirstParentForm calls the GetParentForm routine to get the form instance used as the return value. The return value is Nil when Control has not been assigned, or a form is not found in GetParentForm.

GetFirstParentForm is called from the IntfGetDropFilesTarget method in TWinControl, and from routines which handle accelerator keys for widgetset classes.

## See also

GetParentForm |  | Gets the form instance for the specified Control.