Som dette?:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
EditCount,
LeftEditTop,
RightEditTop,
NumEditBoxesInc: Integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
var
NewEdit: TEdit;
begin
for I := 1 to NumEditBoxesInc do
begin
NewEdit := TEdit.Create(Self);
with NewEdit do
begin
Visible := False;
Parent := Self;
Left := 8;
Top := LeftEditTop;
Name := 'NewEdit' + IntToStr(EditCount);
Text := Name;
Visible := True;
end;
Inc(EditCount);
Inc(LeftEditTop, 24);
Button2.Top := LeftEditTop;
end;
for I := 1 to NumEditBoxesInc do
begin
NewEdit := TEdit.Create(Self);
with NewEdit do
begin
Visible := False;
Parent := Self;
Left := 136;
Top := RightEditTop;
Name := 'NewEdit' + IntToStr(EditCount);
Text := Name;
Visible := True;
end;
Inc(EditCount);
Inc(RightEditTop, 24);
end;
Inc(NumEditBoxesInc, 2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
EditCount := 1;
NumEditBoxesInc := 2;
LeftEditTop := 32;
RightEditTop := 32;
end;
end.
Mvh
DiZpel