unit fmMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, uObjects, Buttons;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    ListBox2: TListBox;
    ListBox3: TListBox;
    ListBox4: TListBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    BitBtn1: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
    aRunner : TExternalRoutines;
    mng : TLBManager;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  aRunner := TExternalRoutines.Create;
  mng := TLBManager.Create;
end;

procedure TForm1.Button5Click(Sender: TObject);
var
  anAdapter : TLBAdapter;
begin
  anAdapter := TLBAdapter.Create(Self.ListBox1);
  mng.AddAdapter(anAdapter);

  anAdapter := TLBAdapter.Create(Self.ListBox2);
  mng.AddAdapter(anAdapter);

  anAdapter := TLBAdapter.Create(Self.ListBox3);
  mng.AddAdapter(anAdapter);

  anAdapter := TLBAdapter.Create(Self.ListBox4);
  mng.AddAdapter(anAdapter);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FreeAndNil(aRunner);
  FreeAndNil(mng);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  mng.ForEcah(TFormClass(Self), aRunner.GenRandomData);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  mng.ForEcah(TFormClass(Self), aRunner.ClearData);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  mng.ForEcah(TFormClass(Self), aRunner.Move);
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  mng.ForEcah(TFormClass(Self), aRunner.SetSameSize);
end;

end.
