Autor Beitrag
Bela Urlaub
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Mi 11.06.03 14:30 
Hi, kann mir jemand sagen, wie ich in meinem Programm Eine Meldung bring, wenn ich es beende : z.B. Man klickt auf X und dann kommt ne Meldung: Wollen sie wirklich beenden? Ja Nein.
Wie geht sowas??

_________________
mensch, menschen können auch probleme haben...
M. Raab
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334
Erhaltene Danke: 1

WIN 7
Delphi XE
BeitragVerfasst: Mi 11.06.03 14:37 
Hallo,

es gibt da das Ereignis OnClose bzw. OnCloseQuery. Dort findest Du eine Variable CanClose. Mit OnClose kannst Du also Deine Sicherheitsabfrage starten und mit der CanClose das beenden verhindern oder ggfs. erlauben. Dazu mußt Du aber die CanClose auf false setzen (z.B. beim Start des Programms -> z.B. OnShow Ereignis) und dann auf true falls Du das schließen erlauben möchtest.


Gruss


Markus

_________________
Das Leben besteht aus Bits und Bytes - nur: wo laufen sie denn ????
Super ... Du kannst das zwar lesen, toll..... aber: völlig zwecklos !!!
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 11.06.03 15:00 
Hier mal ein Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Procedure TForm1.FormCloseQuery (Sender: TObject; Var CanClose: Boolean);
Begin
  CanClose := Application.MessageBox (
      'Programm wirklich beenden?', 
      '',
      MB_YesNo + MB_IconQuestion + MB_DefButton2
    ) = IDYes;
End;


Gruß
Tino
Bela Urlaub Threadstarter
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Mi 11.06.03 23:01 
sry, blick ich net...
@Tino wie bind ich den Code ein??? (Ich hoff, dass ich s irgendwann kapier...)

_________________
mensch, menschen können auch probleme haben...
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mi 11.06.03 23:06 
Hi,

ganz einfach. Klicke auf deine Form, gehe auf Ereignisse im Objektinspektor, such OnCloseQuery, doppelklicke darauf und füge in den leeren Prozedur-Rumpf den Rumpf von Tinos Prozedur ein.

MFG

- Ernesto -
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mi 11.06.03 23:13 
Hi nochmal,

eine weitere Möglichkeit mit dem OnClose-Ereignis:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  case MessageBox(
                  Self.Handle,
                  'Wirklich beenden',
                  'Hinweis',
                  MB_YESNO or
                  MB_ICONINFORMATION
                  ) of
       ID_NO:
         Action := caNone;
  end;
end;


MFG

- Ernesto -
Bela Urlaub Threadstarter
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Do 12.06.03 00:40 
AAAHH!!!!
So geht das!?!
Danke an euch beide

_________________
mensch, menschen können auch probleme haben...