TControlParent (Delphi)
From RAD Studio Code Examples
Language:
Description
This example uses a button placed next to a group box. When you click the button, the group box becomes the parent of the button, so the button moves inside the group box.
Code
procedure TForm1.Button1Click(Sender: TObject); begin if (Button1.Parent <> GroupBox1) then // second click? begin RemoveControl(Button1); GroupBox1.InsertControl(Button1); end; end; { Note that it was necessary to remove the button from the Controls property of the form before the button actually moves into the group box. This code accomplishes the same thing. procedure TForm1.Button2Click(Sender: TObject); begin Button2.Parent := GroupBox1; end;
Uses
- Vcl.Controls.TControl.Parent ( fr | de | ja )
- Vcl.Controls.TWinControl.InsertControl ( fr | de | ja )
- Vcl.Controls.TWinControl.RemoveControl ( fr | de | ja )