Autor Beitrag
volvox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Mi 23.05.07 18:49 
Hallo,
Ich suche diesemDelphi Komponente/Funktion bei der ein Fenster ähnlich wie bei der messagebox erscheint und man ja/nein oder ok/abbrechen auswählen kann.

Ich will beim schließen des Programms noch ne Sicherheitsabfrage machen


Moderiert von user profile iconChristian S.: Topic aus WinForms / WPF verschoben am Mi 23.05.2007 um 19:52
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 23.05.07 18:54 
Wenn du in der Hilfe nach MessageBox guckst, sollten unter Aiehe auch die Alternativen stehen.

Die hier angebrachte Funktion ist MessageDlg

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
volvox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Mi 23.05.07 18:56 
thx
volvox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 112

WIN XP
Delphi 7 Personal
BeitragVerfasst: Mi 23.05.07 19:08 
oh, aber die umsetzung find ich etwas kompliziert.

Das steht in der Hilfe als Beispiel: MessageBox('This should be on top.', 'Look', [smbOK]);

Und dann noch das hier: Delphi-Syntax:

ausblenden Delphi-Quelltext
1:
function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer;					


Ich brauch anscheinend das hier: MB_OKCANCEL Das Meldungsfenster enthält zwei Schaltflächen: OK und Abbrechen.

Und sollte dann entweder den Wert 1 für Ok oder 2 für Abbrechen zurückbekommen.
Die Frage ist jetzt in Welcher Variable dieser Wert gespeichert wir.

Wäre super wenn mir hier jemand für den konkreten fall helfen kann.

Dachte mir sowas wie:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure Form.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   showmessage(????);
   if Wert = 1 halt;
   if Wert = 2 (programm nicht schließen)
end;


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 23.05.07 19:18 
Die Funktion gibt nen Wert zurück.
Du kannst dann sowas schreiben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if MessageDlg({...}) = mrOK then
{...}
else
{...}

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mi 23.05.07 19:21 
ausblenden Delphi-Quelltext
1:
If MessageDlg('blablabla', mtConfirmation, [mbOK, mbCancel], 0) = mrYes then xyz else xyz;					

So aus dem Gedächtnis... Aber nagel mich nicht drauf fest.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Mi 23.05.07 21:07 
user profile iconTimosch hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
If MessageDlg('blablabla', mtConfirmation, [mbOK, mbCancel], 0) = mrYes then xyz else xyz;					

So aus dem Gedächtnis... Aber nagel mich nicht drauf fest.


mrYes kann bei diesem Code nie kommen, da kein "Yes-Button" da ist.
Du musst wie ein Beitrag über dir schon richtig geschrieben auf mrOK prüfen.

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Do 24.05.07 13:07 
user profile iconChatfix hat folgendes geschrieben:
user profile iconTimosch hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
If MessageDlg('blablabla', mtConfirmation, [mbOK, mbCancel], 0) = mrYes then xyz else xyz;					

So aus dem Gedächtnis... Aber nagel mich nicht drauf fest.


mrYes kann bei diesem Code nie kommen, da kein "Yes-Button" da ist.
Du musst wie ein Beitrag über dir schon richtig geschrieben auf mrOK prüfen.

Sry, Tippfehler.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell