Autor Beitrag
arcitC|Crash
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Sa 30.10.04 14:45 
Ich möchte gerne eine Benutzerdefinierte MessageDlg-Box machen. Dazu gibt es eine edit1-komponente und noch einige RadioButtons, wo man einstellen kann, welcher Typ(Confirmation, Information...) und welcher mbButtons angezeigt werden solen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
var
  Form1: TForm1;
  typ, btn: string;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  If radioButton1.checked = true then
    typ := 'mtConfirmation';
  If radioButton2.checked = true then
    typ := 'mtError';
  messageDlg(edit1.text, typ, [mbYes, mbNo], 0);
end;

end.


Allerdings kommt dann immer der Fehler: Inkompatible Typen: 'TMsgDlgType' und 'String'

Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 30.10.04 15:09 
Lass die Hochkommata mal weg. ;)
ScorpionKing
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1150

Win XP

BeitragVerfasst: Sa 30.10.04 15:39 
genau!
luckie hat vollkommen recht.
alles was in hochkommata steht wird als string benutzt:

ausblenden Delphi-Quelltext
1:
str := 'Hallo!';					


aber da mt_confir.... eine konstante ist, kann kein string das ersetzen!

ScorpionKing 8)

Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt.

_________________
Aus dem Urlaub zurück!
Maweki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 197

Ubuntu Linux
Lazarus
BeitragVerfasst: Sa 30.10.04 15:47 
wenn es is eine Variable soll, sollte aber der Variablentyp auch TMsgDlgType sein...
ScorpionKing
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1150

Win XP

BeitragVerfasst: Sa 30.10.04 16:15 
Genau!

_________________
Aus dem Urlaub zurück!
arcitC|Crash Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Sa 30.10.04 16:45 
Ok, thx schonmal, aber
1. was ist eine konstante? und
2. Was ist ein Variablentyp? Vielleicht "var irgendwas: string;" <------string = Variablentyp??
Maweki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 197

Ubuntu Linux
Lazarus
BeitragVerfasst: Sa 30.10.04 19:39 
1. Eine Konstante ist eine Variable, deren Wert man nicht veraendern kann. Im Grunde genommen...

2. Ja, genau das. Anstatt String halt das, was erwartet wird...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
var  
  Form1: TForm1;  
  btn: string;  

 
implementation  

 
{$R *.DFM}  

 
procedure TForm1.Button1Click(Sender: TObject);  
var
  typ: TMsgDlgType;
begin  
  If radioButton1.checked = true then  
    typ := mtConfirmation;  
  If radioButton2.checked = true then  
    typ := mtError;  
  messageDlg(edit1.text, typ, [mbYes, mbNo], 0);  
end;  

 
end.

ich denke, jetzt sollte es funktionieren. Aber da bekommste keine garantie drauf, da ich grade nich testen kann...
arcitC|Crash Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Sa 30.10.04 19:50 
Ja thx! Ist mir auch grade aufgefallen, dass ich da TMsgDlgType hinter schreiben muss. Klappt hevorragend! Danke!