Hi,
folgendes Beispiel switcht den Enabled State der Controls auf Wunsch auch recursiv:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
ChangeEnabled(Panel1, True);
end;
procedure TForm1.ChangeEnabled(AControl: TWinControl; Recursiv: Boolean = True);
Var
i : Integer;
begin
for i := 0 to Pred(AControl.ControlCount) do
begin
AControl.Controls[i].Enabled := not AControl.Controls[i].Enabled;
if Recursiv and (AControl.Controls[i] is TWinControl) and
(TWinControl(AControl.Controls[i]).ControlCount > 0) then
ChangeEnabled(TWinControl(AControl.Controls[i]), Recursiv);
end;
end;
Cu, Frank