Hallo Zusammen,
Über die Procedure text_boxen_ein erstelle ich beliebig viele Editfelder auf einem Form.
Bei Bedarf möchte ich über die Procedure text_boxen_aus die Komponenten zur Laufzeit löschen.
Allerdings wird aktuell nur die letzte Komponenten gelöscht.
Kann mir jemand erklären worin mein Fehler besteht.
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30:
| procedure text_boxen_ein; var i,count:integer; begin SetLength(form3.EditArray, Count); for i:=1 to strtoint(form3.Label2.Caption) do begin form3.EditArray[i] := TEdit.Create(form3); form3.EditArray[i].Parent := Form3; form3.EditArray[i].Left := 150; form3.EditArray[i].Height:=17; form3.EditArray[i].Top := 20 + ((form3.EditArray[i].Height + 2) * i); end; end;
procedure text_boxen_aus; var i:integer;
begin
for i:=1 to strtoint(form3.Label2.Caption) do begin form3.EditArray[i].Destroy; end;
end; |
Gruß
Jo
Moderiert von Narses: Delphi-Tags hinzugefügt.