Обращение через свойство Controls

Материал из DRKB

Обращение через свойство Controls[править | править код]

procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
var
  I: Integer;
  ChildControl: TControl;
begin
  for I:= 0 to GroupBox1.ControlCount -1 do
  begin
    ChildControl := GroupBox1.Controls[I];
    ChildControl.Top := ChildControl.Top + 15;
  end;
end;

Проверить тип контрола надо оператором is:

 if (edit1 is TEdit) then ....

Затем доступ ко всем свойствам путем приведения класса:

 (edit1 as TEdit).Text := ; 


Author: Kiber_rat
Source: Взято с Vingrad.ru http://forum.vingrad.ru
ID: 00357