Autor Beitrag
bigmasterdenis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48



BeitragVerfasst: Mi 19.11.08 14:47 
Hallo Leute,

in meinem Programm möchte ich verhindern dass das Schließen-Kreuz, oben in der Ecke ein Programm immer schließt. Das Schließen des Programms soll bedingt erfolgen: Bedingung erflüllt => Programm normal beenden, Bedingung nicht erfüllt => Warnmeldung und Programm NICHT beenden. Ich könnte natürlich einfach das Schließen-Kreuz zum richtigen Zeitpunkt ausblenden (biSystemmenu), aber das wird den Benutzer eher verwirren.

Gibt es eine elegante Möglchkeit dieses Problem zu lösen?

MfG.
Denis
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Mi 19.11.08 14:52 
Hi,

schau mal in deinen Ereignissen des Formulars nach OnFormClose. Der Übergabeparameter CanClose kann dort gesetzt werden. Wenn noch Fragen sind, melde dich einfach. Sollte aber eigentlich einfach zu implementieren sein.

Grüße
bigmasterdenis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48



BeitragVerfasst: Mi 19.11.08 14:59 
hhm... wie genau funktioniert das mit dem CanClose? Wo soll der Parameter gesetzt werden?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 480

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 19.11.08 14:59 
Das Event heißt aber OnCloseQuery. ;-)

_________________
We are, we were and will not be.
bluesun
ontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 22

Win XP
Delphi 2005 Prof
BeitragVerfasst: Mi 19.11.08 15:07 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  canClose := false;
end;

_________________
Mehr als alles hüte dein Herz; denn von ihm geht das Leben aus.
bigmasterdenis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 48



BeitragVerfasst: Mi 19.11.08 15:11 
Ausgezeichnet! 8) Funktioniert :lol:

Schon wieder was dazugelernt... danke!
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Mi 19.11.08 15:50 
user profile iconGausi hat folgendes geschrieben Zum zitierten Posting springen:
Das Event heißt aber OnCloseQuery. ;-)


Richtig... OnClose hat ja die Action... tut mir Leid. Gab hoffentlich keine Verwirrungen. ;-)