this is what you need!
now please help me with placing my Edits in VertScrollBox2
two questions:
1) how do I make all created Edits visible? (now Visible:=true only for the Edit that is currently being processed in the loop (the other Edits are invisible).
2) how to say that each next Edit should be 10 points lower than the previous one?
the code I use:
Code: Select all
procedure TForm7.TabItem2Click(Sender: TObject);
var
i, ic, ib: Integer;
const
NamePrefix = 'MyEdit';
begin
UniTable1.RecNo:=1+Combobox1.ItemIndex;
UniTable2.Active:=true;
ShowMessage ('Unitable2.FieldCount-4='+inttostr(Unitable2.FieldCount-4));
for i := 1 to Unitable2.FieldCount-4 do begin
TEdit.Create(Self).Name := NamePrefix + IntToStr(i);
with TEdit(FindComponent(NamePrefix + IntToStr(i))) do
begin
ShowMessage(inttostr(i));
Parent := VertScrollBox2;
text:=inttostr(i);
Left:=10;
Top:= i * 20;
end;
end;
end;
I tried to replace the line:
replacement option number 1:
Code: Select all
TEdit.Create(Self).Margins.Left:=10;
TEdit.Create(Self).Margins.Top:= i * 20;
replacement option number 2:
Code: Select all
TEdit(FindComponent(NamePrefix + IntToStr(i))).Margins.Left:=10;
TEdit(FindComponent(NamePrefix + IntToStr(i))).Margins.Top:= i * 20;
replacement option number 3:
Code: Select all
TEdit(NamePrefix + IntToStr(i)).Margins.Left:=10;
TEdit(NamePrefix + IntToStr(i)).Margins.Top:= i * 20;