Autor Beitrag
raiha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Di 07.06.05 14:35 
Hi,

ich erstelle zur Laufzeit dyn. Formulare. Nun würde ich gerne vorher prüfen ob dieses Formular schon angelegt wurde.

Kann ich da mit Application. ... irgendwas machen?

Danke Rainer
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 07.06.05 15:44 
Schau mal nach Suche in: Delphi-Forum, Delphi-Library FINDCOMPONENT. ;)
raiha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Di 07.06.05 16:38 
ja, das habe ich schon. Aber wenn ich mit FindComponent das Frm suche. bringt er mir einen unerlaubten Zugriff wenn das Frm. noch nicht angelegt war.
Wie kann ich das umgehen?

Danke Rainer
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 07.06.05 16:40 
Wie suchst du das Formular denn? Ein bisschen Code wär nicht schlecht. ;)

Ich hatte mir das so vorgestellt, dass du erst prüfst, ob das Formular mit dem Name XYZ überhaupt existiert. Das funktioniert natürlich nur, wenn sie unterschiedliche Namen haben. :nixweiss:
raiha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Di 07.06.05 19:03 
Gibt es eine Möglichkeit auf die Existens eines Obj. zu prüfen? Ich hatte gehofft das FindComponent einen Boolean oder Integerwert zurückliefert mit dem ich dann prüfen kann ob das Frm schon existert oder nicht (aber so ist es ja leider nicht).

Kennt da jehmand was?

Danke Rainer
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 07.06.05 19:09 
Versuch mal Application.FindComponent. Funktioniert aber nur, wen Du das Formular mit Application.CreateForm oder TFormClass.Create(Application) erzeugt hast.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 07.06.05 19:10 
Mensch! Wie wär's denn mal mit der Hilfe oder der Forensuche. Ich hab dir doch oben schon gezeigt, nach was du suchen kannst. ;)

Aber bitte:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if Form1.FindComponent(Button1.Name) = nil then begin
//wenn Button1 nicht gefunden wird auf Form1
end else begin
//wenn Button1 auf Form1 gefunden wird
end;


Genauso machst du's mit deinen Formularen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if Application.FindComponent(Form1.Name) = nil then begin
//wenn Form1 nicht gefunden wird
end else begin
//wenn Form1 gefunden wird
end;

;)
raiha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Mi 08.06.05 08:22 
danke ;-)

hast ja recht
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 08.06.05 14:23 
user profile iconraiha hat folgendes geschrieben:
danke ;-)
hast ja recht

Freut mich. ;) Hast du's hinbekommen?