Autor Beitrag
hansg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 168

Win XP Professional SP3, Vista Ultimate 32 SP1
Delphi 6 Professional
BeitragVerfasst: Di 04.03.03 17:31 
Hallo zusammen,
ich habe einen Messagedialog mit den Schaltflächen Abbechen, Ja und Nein.
Wie kann ich auf jede Taste einzeln reagieren?, wie es bei einer funktioniert weiß ich ja.
ausblenden Quelltext
1:
2:
3:
4:
5:
  if MessageDlg('Test Abfrage, bitte wählen',
  mtConfirmation, [mbAbort, mbYes, mbNo], 0) = mrYes then
  begin

  end;

_________________
Gruß Hans
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 04.03.03 18:05 
Da MessageDlg auch nur eine Funktion ist weist du den Funktionswert einfach einer Variablen zu und fragst sie danach ab:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
 ClickedBtn: Word;
begin
  ClickedBtn := MessageDlg('Test Abfrage, bitte wählen', mtConfirmation, [mbAbort, mbYes, mbNo], 0);
  if ClickedBtn = id_yes then
   showmessage('Yes.');
  if ClickedBtn = id_no then
   showmessage('No.');
  if ClickedBtn = id_abort then
   showmessage('Abort.');


mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
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 05.03.03 09:16 
Zum Beispiel mit einer Case-Anweisung:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Case MessageDlg ('Test Abfrage, bitte wählen', mtConfirmation, [mbAbort, mbYes, mbNo], 0) of
    mrYes:
      ; // Hier der Code bei Yes
    mrNo: 
      ; // Hier der Code bei No
    mrCancel:
      ; // Hier der Code bei Cancel
  End;

Gruß
TINO