Autor Beitrag
Ochsenfrosch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 75

Win 2000 Prof.
Delphi 7
BeitragVerfasst: Mi 09.06.04 14:19 
Hi,

Ich hab eine messagebox, die den benutzer fragt, ob er wirklich die variablen zurückstellen will:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
case MessageBox(0, 'wollen sie wirklich alle zahlen löschen?', 'Warnung', MB_ICONWARNING or MB_OKCANCEL or MB_DEFBUTTON2) of
  idOk: Stunden := 0; Minuten := 0; Sekunden :=0; //hier werden die variablen auf 0 gestellt
  idCancel: ;
end;


die erste anweisung lässt er durchgehen also das klappt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
case MessageBox(0, 'wollen sie wirklich alle zahlen löschen?', 'Warnung', MB_ICONWARNING or MB_OKCANCEL or MB_DEFBUTTON2) of
  idOk: Stunden := 0;//hier wird die variable auf 0 gestellt
  idCancel: ;
end;


aber sobald ich mehrere variablen dazuschreibt geht des net... als fehlermeldung meint er: "konstantenausdruck erwartet" könnt ihr mir helfen?

Mfg Ochsenfrsoch

_________________
Immer positiv denken!!!! (Windows kackt nicht ab, Windows kackt nicht ab....)
Nagelbrett
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: Mi 09.06.04 14:27 
du musst ja auch begin und end setzen wenn du mehrere anweisungen innerhalb eines case benutzen willst..

also so z.b.:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
case MessageBox(0, 'wollen sie wirklich alle zahlen löschen?', 'Warnung', MB_ICONWARNING or MB_OKCANCEL or MB_DEFBUTTON2) of 
  idOk:
    begin
      Stunden := 0; Minuten := 0; Sekunden :=0; //hier werden die variablen auf 0 gestellt 
    end;
  idCancel: ; 
end;


Zuletzt bearbeitet von Nagelbrett am Mi 09.06.04 14:29, insgesamt 2-mal bearbeitet
Ochsenfrosch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 75

Win 2000 Prof.
Delphi 7
BeitragVerfasst: Mi 09.06.04 14:28 
Ou mann, stimmt :shock: ..... wie peinlich :oops: . Danke!!!

_________________
Immer positiv denken!!!! (Windows kackt nicht ab, Windows kackt nicht ab....)