Ver Mensaje Individual
  #9  
Antiguo 21-05-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
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  // Es un GroupBox ?
      with TGroupBox(ScrollBox1.Controls[i]) do  // con el GroupBox hacer
        for j:= 0 to ControlCount-1 do
        begin
          if Controls[j] is TCheckBox then  // Es un CheckBox ?
            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  // Es un TPanel ?
      with TPanel(ScrollBox1.Controls[i]) do  // Con el TPanel hacer
        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 // Es un GroupBox ?
    begin
      Gb:= TGroupBox(ScrollBox1.Controls[i]);  // Gb es el GroupBox
      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  // Es un TPanel ?
    begin
      Tp:= TPanel(SCrollBox1.Controls[i]);  // Tp es el TPanel
      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.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 22-05-2012 a las 18:00:32.
Responder Con Cita