summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-03-30 11:02:42 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-03-30 11:02:42 +0200
commit7d7723a9893df13f2c6de27f2e2468d0413643c4 (patch)
tree88e50660814c288c48159377cb475225b900c4a2
parentc70cd9ba9c801e2f1102398a01b2e97b10e4a404 (diff)
downloadfpGUI-7d7723a9893df13f2c6de27f2e2468d0413643c4.tar.xz
Fixed undefined modal result when message dialog is close with X button.
When a message dialog was shown, mrCancel would be the modalresult if the dialog is closed with the Esc key. But the modalresult was undefined if the user closed the dialog with the window frame X button. Now mrCancel is set in both cases.
-rw-r--r--src/gui/messagedialog.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/messagedialog.inc b/src/gui/messagedialog.inc
index 5a6abfe8..26c5ce4f 100644
--- a/src/gui/messagedialog.inc
+++ b/src/gui/messagedialog.inc
@@ -44,6 +44,7 @@ type
procedure PrepareButtons;
protected
procedure SetWindowTitle(const ATitle: string); override;
+ procedure HandleClose; override;
procedure HandlePaint; override;
procedure HandleShow; override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
@@ -243,6 +244,13 @@ begin
inherited SetWindowTitle(ATitle);
end;
+procedure TfpgMessageDialog.HandleClose;
+begin
+ if ModalResult = mrNone then // Form was close via the X (window frame) button
+ ModalResult := mrCancel;
+ inherited HandleClose;
+end;
+
procedure TfpgMessageDialog.HandlePaint;
var
logo: TfpgImage;