DelphiDelphiVCLPythonPython GUIWindows

How to use the Parent Property

photo of man sitting in front of people

We use the Parent property to get or set the parent of the control. The parent of a control is the control that contains it. For example, if an application includes three radio buttons in a group box, the group box is the parent of the three radio buttons, and the radio buttons are the child controls of the group box.

To serve as a parent, a control must be an instance of a TWinControl descendant.

When creating a new control at run time, assign a Parent property value for the new control. Usually, this is a form, panel, group box, or a control that is designed to contain another. Changing the parent of a control moves the control onscreen so that it is displayed within the new parent. When the parent control moves, the child moves with the parent.

Some controls (such as ActiveX controls) are contained in native windows rather than in a parent VCL control. For these controls, the value of Parent is nil (Delphi) or NULL (C++) and the ParentWindow property specifies the window.

Note: The Parent property declared in TControl is similar to the Owner property declared in TComponent, in that the Parent of a control frees the control just as the Owner of a component frees that component. However, the Parent of a control is always a windowed control that visually contains the control, and is responsible for writing the control to a stream when the form is saved. The Owner of a component is the component that was passed as a parameter in the constructor and, if assigned, initiates the process of saving all objects (including the control and its parent) when the form is saved.

Here is the working example of the implementation of Parent in the main panel creation:

Here is the working example of the implementation of Parent in the page control creation:

Here is the working example of the implementation of Parent in the label creation:

Here is the working example of the implementation of Parent in the edit box creation:

Here is the working example of the implementation of Parent in the check box creation:

Here is the working example of the implementation of Parent in the list box creation:

Here is the working example of the implementation of Parent in the datetime creation:

Here is the working example of the implementation of Parent in the combo box creation:

Here is the working example of the implementation of Parent in the radiogroup creation:

Here is the working example of the implementation of Parent in the button creation:

Here is the working example of the implementation of Parent in the memo creation:

Here is the working example of the implementation of Parent in the shape creation:

Here is the working example of the implementation of Parent in the color box creation:

Here is the working example of the implementation of Parent in the draw grid creation:

 

Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.

close
Related posts
DelphiDelphiVCLPythonPython GUIWindows

What is DelphiVCL.Application.CreateHandle?

DelphiDelphiVCLPythonPython GUIWindows

Creating A New Application With DelphiVCL.Application.Create

DelphiDelphiVCLPythonPython GUIWindows

All You Need To Know About Application.DialogHandle

DelphiDelphiVCLPythonPython GUIWindows

What is the FieldAddress Property in DelphiVCL.Application?

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

jaJapanese