Autor Beitrag
recall
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 08.09.03 00:32 
Hallo,
wenn ich folgenden Code in meinem Proggi benutze:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
      F := TForm(FindGlobalComponent(FormPar));
      F.InsertComponent(Obj);
      TTParent := TWinControl(FindComp(F, Par));
      if TTParent<>nil then
        Obj.Parent := TTParent
      else
        Obj.Parent := F;
... dann gibts den im Titel beschriebenen Fehler ABER ERST NACH DEM PROGRAMMENDE (Also beim Schließen der MainForm)!
Lasse ich InsertComponent weg, dann funzt das Programm nicht mehr richtig, aber der Fehler ist weg ! Also liegt es zumindest daran !
Was kann ich tun ?

Viele Grüsse.


Zuletzt bearbeitet von recall am Di 09.09.03 11:52, insgesamt 1-mal bearbeitet
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 08.09.03 09:31 
Erklär mal ein bisschen was du vorhast... werd aus deinem obigen Code nicht ganz schlau... :?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
recall Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 08.09.03 16:13 
Motzi hat folgendes geschrieben:
Erklär mal ein bisschen was du vorhast... werd aus deinem obigen Code nicht ganz schlau... :?

Das ganze wird ein Interpreter, nur sinds schon 800 Zeilen allein in dieser Funktion, daher kann ich sie nicht ganz posten ;) .
Das wäre auch unsinnig, weil ich mir dann anhören müsste, welche komischen funktionen diese funktion verwendet (nämlich auch meine eigenen) usw...

Das Ganze spielt aber sowieso keine Rolle, da egal wie ich InsertComponent benutze IMMER eine solche Fehlermeldung beim Programmende kommt (also auch wenn ich nur 2 Zeilen in nen OnClick schreiben würde) :(

Leider weiss ich so gar nicht woran es liegen könnte und die Delphi-Doku gibt mir da auch keinen hint !

Viele Grüsse.
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Mo 08.09.03 16:21 
Wie wärs wenn Du statt
ausblenden Delphi-Quelltext
1:
F.InsertComponent(Obj);					

ausblenden Delphi-Quelltext
1:
Obj.Owner := F					

schreibst?

barfuesser
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 08.09.03 16:33 
Owner ist aber eine ReadOnly-Eigenschaft...

@recall: 800 Zeilen in einer Funktion? Wie wärs mit einer bisschen besseren Einteilung? ;)
Aber irgendwie fehlen noch immer jede Menge Informationen für eine Fehleranalyse.. weshalb brauchst du InsertComponent? Was macht die Funktion? ect.

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
recall Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 08.09.03 20:27 
Hallo,

@motzi: Bessere Einteilung, wozu ?
Da kommt jeder Befehl fast nur 1mal vor !
Ansonsten ist das nicht viel bei über 35.000 Zeilen Quellcode, oder soll ich die in 350 procs packen ??? ;) .

Also InserComponent brauche ich, damit meine zur LZ erstellte Form die Kompos per FindComponent findet, ohne gehts nicht :( .
Aber wenn jemand hierfür eine bessere Lösung hat ???

Also, wer weiss was ???

Viele Grüsse.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mo 08.09.03 22:46 
recall hat folgendes geschrieben:
Aber wenn jemand hierfür eine bessere Lösung hat ???

Solange ich nicht weiß, was genau du vor hast nicht... :roll: :?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
recall Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Mo 08.09.03 23:08 
OK, einfach folgendes Problem:

Ich will zur LZ eine TForm und irgendein TControl erzeugen.
Danach will ich, dass das neu erzeugte TControl (kann als Beispiel ein Panel sein) mit FindComponent() auffindbar ist.

Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
Form := TForm.Create(Self);
Panel := TPanel.Create(Self);
Form.InsertComponent(Panel);
Panel.Parent := Form;

Und wenn ich das versuche gibt es die schon beschriebene Fehlermeldung !!!

Also ?

Viele Grüsse.
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Di 09.09.03 07:23 
recall hat folgendes geschrieben:
Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
Form := TForm.Create(Self);
Panel := TPanel.Create(Self);
Form.InsertComponent(Panel);
Panel.Parent := Form;

Was spricht gegen
ausblenden Delphi-Quelltext
1:
2:
3:
Form := TForm.Create(Self);
Panel := TPanel.Create(Form);
Panel.Parent := Form;

barfuesser
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Di 09.09.03 08:13 
Muss barfuesser recht geben..! :roll: Der Parameter des Constructors bestimmt bereits den Owner! Wenn du ihn da also schon festlegst brauchst du kein InsertComponent mehr...

BTW: was ist Self für ein Objekt?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
recall Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Di 09.09.03 11:48 
thx an alle, so funktioniert es ! :beer:
Aber wieso geht denn InsertComponent nicht ???
Das kanns doch nicht sein. :?:

Viele Grüsse.
barfuesser
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 324



BeitragVerfasst: Di 09.09.03 11:57 
Setzt Du vielleicht die Property Name des einzufügenden Objektes?

barfuesser
recall Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 449



BeitragVerfasst: Di 09.09.03 13:12 
ja, aber der ist einmalig, also dürfte es laut Delphi-Hilfe keine Probleme geben, oder ???