How about something like this? This procedure places the Edit boxes in a vertical column. Variations might include a different layout or a limit to the number of boxes that can be created.
FirstBoxTop = 10;
BoxLeft = 10;
BoxWidth = 121;
SpaceBetweenBoxes = 4;
var
I: Integer;
begin
Code:
// find what boxes already exist named EditX
// where X is a sequential number from 1..N
Code:
I := 1;
while FindComponent('Edit'+IntToStr(I))<>nil do
Inc(I);
Code:
// create an Edit button with next number I
// and initialize properties
Code:
with TEdit.Create(Self) do begin
Parent := Self;
Name := 'Edit' + IntToStr(I);
Text := '';
Left := BoxLeft;
Width := BoxWidth;
Top := FirstBoxTop +
(Height * (I-1)) +
(SpaceBetweenBoxes * (I-1));
end;
end;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.