summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-01-12 13:12:34 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-01-12 13:12:34 +0000
commitb0219eb7cb90e11a92ec8974e3a9e971c0e0a61b (patch)
tree95293fd0d5149315fdcccc538f9accb03a50b5d6 /src/gui
parentd8cbd342f020d714abcb3f66da0a43d8b4060618 (diff)
downloadfpGUI-b0219eb7cb90e11a92ec8974e3a9e971c0e0a61b.tar.xz
* Fixed MessageDialog crash on exit under Windows.
* Fixed the mbYesNoCancel button order in a MessageDialog. * Extended the FileDialog example for testing purposes of the MessageDialog class.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/messagedialog.inc25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui/messagedialog.inc b/src/gui/messagedialog.inc
index cb838378..23497a0f 100644
--- a/src/gui/messagedialog.inc
+++ b/src/gui/messagedialog.inc
@@ -1219,6 +1219,25 @@ var
i: TfpgMsgDlgBtn;
begin
Result := 0;
+
+ // try known sets first
+ if Buttons = mbYesNoCancel then
+ begin
+ { todo: At some stage the StyleManager can give use the correct button
+ order based on the OS and Window Manager. }
+ Result := 3;
+ sl.Add(cMsgDlgBtnText[mbYes] + '=' + IntToStr(Ord(mbYes)));
+ sl.Add(cMsgDlgBtnText[mbNo] + '=' + IntToStr(Ord(mbNo)));
+ sl.Add(cMsgDlgBtnText[mbCancel] + '=' + IntToStr(Ord(mbCancel)));
+ case DefaultButton of
+ mbYes: lDefault := 0;
+ mbNo: lDefault := 1;
+ mbCancel: lDefault := 2;
+ end;
+ Exit;
+ end;
+
+ // if we got here, try all known buttons.
for i := Low(TfpgMsgDlgBtn) to High(TfpgMsgDlgBtn) do
begin
if i in Buttons then
@@ -1382,11 +1401,7 @@ end;
destructor TfpgMessageDialog.Destroy;
begin
- while FButtonList.Count > 0 do
- begin
- TfpgButton(FButtonList.Last).Free;
- FButtonList.Remove(FButtonList.Last);
- end;
+ FButtonList.Clear;
FInformativeText.Free;
inherited Destroy;
end;