Hallo Profis,
suche mal wieder Rat. Im Forum hat Frühlingsrolle einen abgewandelten MessageDlg vorgestellt mit dem Höhe und Breite des Fensters veränderbar ist wie folgt:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
| Procedure ShowSizedDlg(ACaption, AMsg: string; APos: TPoint; AWidth, AHeight: Integer; ADlgType: TMsgDlgType; AButton: TMsgDlgButtons); var temp: TForm; begin temp := CreateMessageDialog(AMsg, ADlgType, AButton); try temp.Caption := ACaption; temp.Left := APos.X; temp.Top := APos.Y; temp.Width := AWidth; temp.Height := AHeight; temp.ShowModal; finally temp.Free; end; end; |
Solange es nur um Bestätigung mit Ok geht, funktioniert auch alles bestens. Ich wollte nun die Routine zur Mehrfachabfrage abändern als Funktion, die den Rückgabewert auswertet wie folgt:
Delphi-Quelltext
1: 2:
| Function ShowSizedDlg(ACaption, AMsg: string; APos: TPoint; AWidth, AHeight: Integer; ADlgType: TMsgDlgType; AButton: TMsgDlgButtons)[b]:integer;[/b] |
Mein Code lautet:
Delphi-Quelltext
1: 2: 3: 4: 5: 6:
| ... if ShowSizedDlg('Rückfrage', Text1, Point(left, top), Breite, Hoehe, mtConfirmation, [mbYes, mbCancel]) <> mrYes then exit else ... |
Nun stelle ich fest, dass ShowSizeDlg überhaupt keinen brauchbaren Rückgabewert liefert (vieles schon versucht). Die Routine führt immer zu "exit".
Frage:
was mache ich falsch?,
müsste im finally-Zweig ein Befehl stehen: "Result:= ???(Rückgabewert)". (temp ist ein TForm-Object),
Definiere ich den Rückgabewert der Function nicht mit integer sondern mit TMsgDlgBtn, dann lässt sich das Programm nicht übersetzen.
Habe Knoten im Kopf. Wer kann helfen?
hRb