Hallo,
Ich mache in etwa folgendes:
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: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55:
| Obj := TT.Create(Self); Obj.Name := XNewName(XType, FormPar);
[...]
TTParent := TWinControl(FindComp(FindGlobalComponent(FormPar), Par)); if TTParent<>nil then Obj.Parent := TTParent else Obj.Parent := TWinControl(FindGlobalComponent(FormPar));
if XProperties<>nil then For I := 0 to XProperties.Count-1 do XSetProperty(FormPar + '.' + Obj.Name, XProperties[I], XValues[I]);
[...]
function TForm1.XSetProperty(XComponent, XProperty, XValue: String): Boolean; var Obj: TComponent; F: TForm; I: Word; FormPar, Par: String; begin Result := False; try
I := 1; FormPar := ''; Repeat if I<Length(XComponent)+1 then if XComponent[I]<>'.' then FormPar := FormPar + XComponent[I]; Inc(I); Until ((XComponent[I]='.') or (I>=Length(XComponent)+1)); Inc(I); Par := ''; Repeat if I<Length(XComponent)+1 then Par := Par + XComponent[I]; Inc(I); Until (I>=Length(XComponent)+1);
F := TForm(FindGlobalComponent(FormPar));
Obj := F.FindComponent(Par);
if (F is TForm) and (Obj=nil) then begin XProperty := FormPar + '.' + XProperty; E_Props.SetProp(XProperty, XValue); Result := True; end; |
Wie im Sourcecode markiert, wird Obj kein Wert zugewiesen.
Was tun ?
Den Namen (also die String-Variable Par) habe ich überprüft. Stimmt mit der erstellten Kompo überein. Diese wird auch sichtbar in der Form, aber ich kann sie mit FindComponent nicht finden
Achso, das Formular (wurde auch zur Laufzeit erstellt) findet er aber mit FindGlobalComponent.
Viele Grüsse.
//Edit:
| Zitat: |
| Lükes Grundlage der Programmierung: Es wird nicht funktionieren. |
grummel
