Tell me,please,whether TPanel
has method by which you can clear all the objects on the TPanel
?
For example, if some labels were placed on TPanel
(Label.Visible = true), then after applying the method they became invisible (Label.Visible: = false).
Do you want to destroy all objects on the TPanel or you need only hide?
If you need only hide all components of the panel this codes may help you:
Example of HideAll components of panel
procedure TForm1.chk_Visible_AllChange(Sender: TObject);
var
n: Integer;
cmp : TComponent;
begin
for n:= 0 to ComponentCount-1 do
begin
cmp := Components[n];
if cmp.GetParentComponent=Panel1 then
begin
if cmp is TLabel then
TLabel(cmp).Visible:= chk_Visible_All.Checked;
if cmp is TButton then
TButton(cmp).Visible:= chk_Visible_All.Checked;
if cmp is TMemo then
TMemo(cmp).Visible:= chk_Visible_All.Checked;
if cmp is TGroupBox then
TGroupBox(cmp).Visible:= chk_Visible_All.Checked;
end;
end;
end;