Autor Beitrag
Snippy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Mi 16.10.02 18:03 
Hi!
Ich möchte gerne in der Prozedure "TForm1.FormCreate"
eine Aktion durchführen und danach form1 automatisch schließen lassen, doch bei den Befehlen " close" und " form1.close" tut sich nicht!

Was kan ich tun???

_________________
Carpe Diem!
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Mi 16.10.02 18:42 
setzt mal deine "Schließ"-Anweisung in das OnShow oder OnActivate-Ereignis. Dann müsste es funktionieren.

_________________
Viele Grüße
Jakob
Snippy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Mi 16.10.02 18:44 
Das hab ich mir auch schon gedacht, aber es sollen ja noch aktionen ausgeführt werden, bevor form1 geschlossen wird!!!

_________________
Carpe Diem!
DeCodeGuru
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1333
Erhaltene Danke: 1

Arch Linux
Eclipse
BeitragVerfasst: Mi 16.10.02 18:50 
ja, die Aktionen führst du in dem OnCreate-Ereignis aus und die Form kannste dann wieder im OnActivate-Ereignis schließen.

Das OnActivate und das OnShow-Ereignis werden nach dem OnCreate-Ereignis "ausgeführt".

_________________
Viele Grüße
Jakob
Snippy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Mi 16.10.02 19:22 
kann ich da auch einen if-then satz reinschreiben???

_________________
Carpe Diem!
mars
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 238

Debian Woody, Win 2000, Win XP
D7 Ent, Kylix 3
BeitragVerfasst: Mi 16.10.02 19:46 
türlich, das ist eine ganz normale prozedur...
Snippy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Mi 16.10.02 20:03 
NEEE!
Dabei schließt er das auch nicht!!!
Könnte es nicht gehen, wenn ich sag, dass das Beenden Button gedrückt werden soll????

Aber wie latet der Sourcecode???

Das soll nachher so sein:
Wen eine bestimmte Datei im Verzeichnis des Programms ist, dann soll der ohne Knopfdruck das Programm beenden aber zuvor eben noch eine Aktion in Form1create ausführen!

_________________
Carpe Diem!
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mi 16.10.02 20:18 
Versuch mal mit

ausblenden Quelltext
1:
Halt;					


Mit Close kannst du das Formular garnicht schließen, weil das Formular noch garnicht erstellt wurde. OnShow und OnActivate sind auch Shit, da sie öfters als nur ein mal aufgerufen werden können.

Alternativ und mit etwas Vorbehalt kann man auch

ausblenden Quelltext
1:
Application.Terminate;					


nehmen. Das Problem mit Terminate ist, daß sich das ganze noch etwas hinziehen kann bis das Programm reagiert.
Snippy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Mi 16.10.02 21:37 
Jetzt gehts :D

Vielen Dank!

CYA

_________________
Carpe Diem!
Steffer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 299



BeitragVerfasst: Do 17.10.02 16:15 
Das klingt schon ein bischen abenteuerlich ...
Warum prüfst du nicht vor der Erzeugung, ab die Datei existiert?
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
if not FileExists('C:\123.txt')
then begin
       Application.CreateForm(TForm1, Form1);
       .....
       end
else ....

_________________
Keine Signatur ...