Autor Beitrag
professorbass
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 19.08.10 13:41 
Hallo
Kann mir einer sagen was ich da falsch mache?
es kommt immer der Fehler Inkompatible typen TMsgDlgBtn Und Integer.
Aber wie sollte es sonst gehen mir fällt keine andere Möglichkeit ein...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.Button1Click(Sender: TObject);
var
  MsgType: TMsgDlgType;
  MsgBtn: TMsgDlgBtn;
begin
// if Fehler = 'STOP' Then MsgType := MB_ICONSTOP
// else if Information = 'INFORMATION' Then MsgType := MB_ICONINFORMATION
// else if Warnung = 'WARNING' Then MsgType := MB_ICONWARNING
// else if Frage = 'QUESTION' Then MsgType := MB_ICONQUESTION
// else if Ohne = 'Kein' Then MsgType := '';

if RadioButton1.Checked = True Then MsgBtn := MB_OK
else if RadioButton2.Checked = True Then MsgBtn := MB_ABORTRETRYIGNORE
else if RadioButton3.Checked = True Then MsgBtn := MB_OKCANCEL
else if RadioButton4.Checked = True Then MsgBtn := MB_RETRYCANCEL
else if RadioButton5.Checked = True Then MsgBtn := MB_YESNO
else if RadioButton6.Checked = True Then MsgBtn := MB_YESNOCANCEL;

MessageBox(0, Edit2.Text, Edit1.Text, MsgBtn + MsgType);
end;
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 19.08.10 13:46 
Probier es mal mit nem OR statt dem +. Weiters würde ich dir empfehlen auch den Rückgabewert von der MessageBox abzufragen. ;)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 19.08.10 14:32 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
[...]
if RadioButton1.Checked = True Then MsgBtn := MB_OK
else if RadioButton2.Checked = True Then MsgBtn := MB_ABORTRETRYIGNORE
else if RadioButton3.Checked = True Then MsgBtn := MB_OKCANCEL
[...]

Niemals auf True prüfen! Siehe DT: Boolean Tutorial :mahn:
professorbass Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 19.08.10 14:42 
Ja ok gut Danke habe ich jetzt alles.
Aber selbes Problem bleibt
Inkompatible typen TMsgDlgBtn Und Integer.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 19.08.10 14:47 
user profile iconprofessorbass hat folgendes geschrieben Zum zitierten Posting springen:
Ja ok gut Danke habe ich jetzt alles.
Aber selbes Problem bleibt
Inkompatible typen TMsgDlgBtn Und Integer.

Ich kann mich nicht erinnern, dass bei den Konstanten ein Underscore [_] vorkam. Hast Du da noch etwas selbst definiert? Ansonsten lass diese einfach weg. :nixweiss:

Konkret, mbOK statt MB_OK etc.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 19.08.10 14:50 
Ne, das mit den Underscores passt schon, siehe diese Seite. Und da steht auch das was ich in der ersten Antwort erwähnt habe, das man das + durch ein OR ersetzen soll. Aber auf mich hört ja keiner. :mrgreen:

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
professorbass Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 19.08.10 14:54 
Einzelne Buttons gehen nur Kombinationen gehen nicht das mit dem + das habe ich ersetzt trotzdem hat es mir nix gebracht!
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 19.08.10 15:02 
Probier mal die Variablen als Cardinal zu deklarieren und nicht als TMsgDlgBtn und TMsgDlgType.

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 19.08.10 16:54 
ausblenden Delphi-Quelltext
1:
MsgBtn := MB_OK					

MsgBtn ist vom Typ TMsgDlgBtn. Und ist in der VCÖ deklariert. MB_OK ist eine Integerkonstante der WinAPI.
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Do 19.08.10 17:29 
user profile iconelundril hat folgendes geschrieben Zum zitierten Posting springen:
Und da steht auch das was ich in der ersten Antwort erwähnt habe, das man das + durch ein OR ersetzen soll. Aber auf mich hört ja keiner. :mrgreen:


Sollte eigentlich das gleiche sein, nicht?
ausblenden Quelltext
1:
2:
3:
  00000001
+ 00000010
= 00000011


Bei OR kommt dasselbe heraus. Auch bei negativen Zahlen. Und die Konstanten enthalten ja jeweils nur eine Eins, denn sonst wird es sinnlos.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: Do 19.08.10 17:45 
user profile iconJakob_Ullmann hat folgendes geschrieben Zum zitierten Posting springen:
Bei OR kommt dasselbe heraus. Auch bei negativen Zahlen. Und die Konstanten enthalten ja jeweils nur eine Eins, denn sonst wird es sinnlos.



matthias-hielscher.d...tandard-Dialoge.html hat folgendes geschrieben:
MB_YESNOCANCEL
Wert der Konstanten: 3


Andererseits haben die Icons andere Nummern, also müsste es doch egal sein ob + oder OR

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
professorbass Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 19.08.10 17:55 
jap. es funktioniert jetzt mit + oder or ist egal was man nimmt
vielen Dank ihr habt mit bissel weitergeholfen jetzt muss ich selber wieder gucken
wie ich weiter komm THX
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 19.08.10 18:21 
So lange immer nur ein Bit gesetzt ist, ist es egal. Aber wer garantiert das? Oder guckt ihr immer nach? Besser und auch sicherer ist es auf alle Fälle es ein bitweise OR-verknüfung auch mit dem OR-Operator zu verknüpfen und nicht das Plus-Zeichen zu verwenden.