Autor Beitrag
Tabakbrummel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 124

win 7
Turbo Delphi, VS 20010 Express
BeitragVerfasst: So 16.10.05 22:00 
Hallo erst mal

Ich habe da ein Problem mit CanClose und BeendenClick. Beim Programm beenden muß ich immer doppelt klicken um es zu beenden. Woran liegt der Fehler?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Programmbeenden1Click(Sender: TObject);
begin
  Application.MessageBox ('Programm wirklich beenden?''Bestätigung',
  MB_YesNo+MB_IconQuestion+MB_DefButton2);
  Close;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
VAR
  Antwort : INTEGER;
begin
  Antwort := Application.MessageBox ('Programm wirklich beenden?''Bestätigung',
             MB_YesNo+MB_IconQuestion+MB_DefButton2);
  CanClose := Antwort = IDYes;
end;

Mfg
Tabakbrummel
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 16.10.05 23:19 
Moin!

Ich würde sagen, lass Programmbeenden1Click() weg, dass mach doch schon das CanClose.

cu
Narses
Tabakbrummel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 124

win 7
Turbo Delphi, VS 20010 Express
BeitragVerfasst: So 16.10.05 23:35 
Hallo

Nee das geht nicht,denn ich habe das Programmbeenden1Click() im Menu Datei|Beenden und das CanClose fürs X.

Mfg
Tabakbrummel
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 16.10.05 23:36 
Moin!

Dann mach im Programmbeenden1Click() nur ein Close; fettich. :wink:

cu
Narses
Tabakbrummel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 124

win 7
Turbo Delphi, VS 20010 Express
BeitragVerfasst: Di 18.10.05 00:00 
Hallo Narses

Es funktioniert und besten dank für den Tipp.

MfG
Tabakbrummel