Hallo,
ich erstelle zur Laufzeit einige Komponenten:
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:
| var FormDialog: TFormDialog; MyEdit: TEdit; MyLabel: TLabel; MyCombo: TComboBox;
implementation
. . . .
procedure TFormDialog.ErstelleEdits(Name: String;Editor: String; Hoehe: Integer; Breite: Integer;Links: Integer; Oben: Integer); with MyCombo do begin MyCombo := TComboBox.Create(self); Parent := FormDialog; Name := 'ComboTyp2'; Height := Hoehe; Width := Breite; Left := Links; Top := Oben; end; |
Das Füllen der komponenten mit Werten funktioniert noch einwandfrei.
Nun möchte ich die erstellten Komponenten aber natürlich auch abfragen und das
haut überhaupt nicht hin:
Delphi-Quelltext
1: 2: 3: 4: 5:
| . . . MyCombo := TComboBox(FormDialog.FindComponent('ComboTyp2')); Test := MyCombo.Text; |
wenn ich folgendes mache, überspringt er die Zeile, findet also nichts:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
| var Edit: TComponent; Text: String; begin . . . Edit := FormDialog.FindComponent('ComboTyp2'); If Assigned (Edit) then Text := (Edit as TComboBox).Text; |
Was mache ich bloß falsch? Ich bin schon ganz verzweifelt
Viele Grüße
Weide
Moderiert von
Motzi: Code- durch Delphi-Tags ersetzt.