Autor Beitrag
limmi
Hält's aus hier
Beiträge: 6

WinXP, Win98
D6 Pers
BeitragVerfasst: Mi 21.04.04 11:32 
Hallo,

bin noch ganz frich in Delphi...
Will per onCLick eines Buttons das Programm beenden.
Gibt es da eine Procedure?

Danke im Vorraus!

_________________
preussen-racing.de
FaTaLGuiLLoTiNe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 5

Windows 7, Windows 8.1
Delphi XE
BeitragVerfasst: Mi 21.04.04 11:45 
Hi limmi

Doppelklick auf das Ereignis "OnClick" im Objektinspektor, dann Code vervollständigen, so dass es in etwa so aussieht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function TForm1.Button1Click(Sender: TObject);
begin
 Form1.Close;
end;


Der Befehl TForm.Close schliesst ein Fenster. Wenn dieses das Hauptfenster der Anwendung ist, wird auch das Programm beendet.

_________________
<< FaTaLGuiLLoTiNe >>
Rhinoceroses don't play games!
limmi Threadstarter
Hält's aus hier
Beiträge: 6

WinXP, Win98
D6 Pers
BeitragVerfasst: Mi 21.04.04 12:27 
Danke dir, funktioniert!

_________________
preussen-racing.de
sebastian123
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mi 21.04.04 13:41 
zum programm beenden :
application.terminate;

in das onclick eregnis!


(oder rechts oben auf das X !! ;-) )
FaTaLGuiLLoTiNe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 5

Windows 7, Windows 8.1
Delphi XE
BeitragVerfasst: Mi 21.04.04 13:57 
Zitat:

zum programm beenden :
application.terminate;


Klar, man kann auch System.Halt(0) machen, aber das Schliessen des Hauptformulars mit TForm.Close ist auf jeden Fall die "sauberste" Lösung.

_________________
<< FaTaLGuiLLoTiNe >>
Rhinoceroses don't play games!
sebastian123
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Do 22.04.04 10:37 
warum ?
:?:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 22.04.04 10:51 
Weil beim Aufruf von Close auch noch die entsprechenden OnClose-Ereignisse aufgerufen werden. Bei Application.Terminate nicht.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
sebastian123
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Do 22.04.04 10:55 
aha !! danke :-)