From RAD Studio API Documentation
Jump to: navigation, search


function ValidParentForm(Control: TControl; TopForm: Boolean = True): TCustomForm;


extern DELPHI_PACKAGE TCustomForm* __fastcall ValidParentForm(Vcl::Controls::TControl* Control, bool TopForm = true);


Type Visibility Source Unit Parent
function public
Vcl.Forms Vcl.Forms


Returns the form or property page that contains a specified control.

Call ValidParentForm to obtain the descendant of TCustomForm that contains the control specified by the Control parameter. If the TopForm parameter if true, this function goes all the way up the parent chain for Control until it finds a Form with no parent. If TopForm if false, this function goes up the parent chain until it finds a Form that is a TCustomForm.

If the control is not contained in a form (for example, an ActiveX control embedded in another type of window), ValidParentForm raises an EInvalidOperation exception.

See Also