Autor Beitrag
Girgl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 281


D6 Enterprise
BeitragVerfasst: Do 01.04.04 14:17 
Hi,
ich bekomm andauernd den Fehler "Inkyompatible Typen":Integer und Set,bei dieser Anweisung hier

ausblenden Delphi-Quelltext
1:
Application.MessageBox('Test','Beenden?',[mb_ok]);					


Wüsste net was falsch is,bitte um aufklärung :wink:
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 01.04.04 14:27 
Einfach die eckigen Klammern weglassen:
ausblenden Delphi-Quelltext
1:
Application.MessageBox('Test', 'Beenden?', MB_OK);					

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Girgl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 281


D6 Enterprise
BeitragVerfasst: Do 01.04.04 14:32 
aber ich dachte bei flags muss man immer eckige klammern setzen?
also brauch ich eigentlich nie eckige klammern setzen?
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: Do 01.04.04 14:39 
Ich würde es mit MessageDlg machen.
Bsp. aus der Hilfe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);

begin
  if MessageDlg('Willkommen in meiner Object PascalAnwendung. Jetzt beenden?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
    MessageDlg('Programm wird beendet.', mtInformation,
      [mbOk], 0);
    Close;
  end;
end;


Da müssen die Buttons in [] eingeschlossen werden...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 01.04.04 14:42 
Girgl hat folgendes geschrieben:
aber ich dachte bei flags muss man immer eckige klammern setzen?

Das kommt ganz darauf an wo... Application.MessageBox kapselt nur die API-Funktion MessageBox und die erwartet als letzten Parameter einen Integer, der eine Kombination von verschiedenen Flags enthalten kann. Diese Flags sind alle Konstante. zB:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
  MB_OK = $00000000;
  MB_OKCANCEL = $00000001;
  MB_ABORTRETRYIGNORE = $00000002;
  MB_YESNOCANCEL = $00000003;
  MB_YESNO = $00000004;
  MB_RETRYCANCEL = $00000005;

  MB_ICONHAND = $00000010;
  MB_ICONQUESTION = $00000020;
  MB_ICONEXCLAMATION = $00000030;
  MB_ICONASTERISK = $00000040;
  MB_USERICON = $00000080;

Um nun mehrere dieser Flags zu kombinieren verknüpft man diese per or.. zb so:
ausblenden Delphi-Quelltext
1:
Application.MessageBox('Test', 'Beenden?', MB_OK or MB_ICONQUESTION);					


Die eckigen Klammern braucht man nur wenn man mit Sets arbeitet wie zB bei der Funktion MessageDlg...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!