Hola.
Aunque seguramente no lo haga tan claro como
roman, con respecto al código, te pongo un ejemplo con un ScrollBox que contiene además del GroupBox un Panel con controles.
Lo podes hacer de este modo:
Código Delphi
[-]
var
i,j: Integer;
begin
for i:= 0 to ScrollBox1.ControlCount-1 do
begin
if ScrollBox1.Controls[i] is TGroupBox then with TGroupBox(ScrollBox1.Controls[i]) do for j:= 0 to ControlCount-1 do
begin
if Controls[j] is TCheckBox then TCheckBox(Controls[j]).Checked:= True;
if Controls[j] is TLabel then
ListaDeNombres.Add(TLabel(Controls[j]).Caption);
if Controls[j] is TRadioButton then
TRadioButton(Controls[j]).Checked:= True;
end;
if ScrollBox1.Controls[i] is TPanel then with TPanel(ScrollBox1.Controls[i]) do for j:= 0 to ControlCount-1 do
begin
if Controls[j] is TEdit then
TEdit(Controls[j]).Color:= clRed;
if Controls[j] is TButton then
TButton(Controls[j]).Caption:= 'Hola';
end;
end;
end;
Pero quizá te resulte más entendible así:
Código Delphi
[-]
var
i,j: Integer;
Gb: TGroupBox;
Tp: TPanel;
begin
for i:= 0 to ScrollBox1.ControlCount-1 do
begin
if ScrollBox1.Controls[i] is TGroupBox then begin
Gb:= TGroupBox(ScrollBox1.Controls[i]); for j:= 0 to Gb.ControlCount-1 do
begin
if Gb.Controls[j] is TCheckBox then
TCheckBox(Gb.Controls[j]).Checked:= True;
if Gb.Controls[j] is TLabel then
ListaDeNombres.Add(TLabel(Gb.Controls[j]).Caption);
if Gb.Controls[j] is TRadioButton then
TRadioButton(Gb.Controls[j]).Checked:= True;
end;
end;
if ScrollBox1.Controls[i] is TPanel then begin
Tp:= TPanel(SCrollBox1.Controls[i]); for j:= 0 to Tp.ControlCount - 1 do
begin
if Tp.Controls[j] is TEdit then
TEdit(Tp.Controls[j]).Color:= clRed;
if Tp.Controls[j] is TButton then
TButton(Tp.Controls[j]).Caption:= 'Hola';
end;
end;
end;
end;
TWinControl es la clase base para todos los controles que contienen ventanas (
TObject->
TPersistent->
TComponent->
TControl->
TWinControl). De
TWinControl derivan por ejemplo:
TEdit, TPanel, TButton, TComboBox,...
Saludos.