diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/fpg_base.pas | 18 | ||||
-rw-r--r-- | src/gui/fpg_dialogs.pas | 8 | ||||
-rw-r--r-- | src/gui/fpg_form.pas | 4 | ||||
-rw-r--r-- | src/gui/messagedialog.inc | 8 |
4 files changed, 14 insertions, 24 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index c592e6e7..b3595300 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -32,7 +32,6 @@ type TfpgColor = type longword; // Always in RRGGBB (Alpha, Red, Green, Blue) format!! TfpgString = type string; TfpgChar = type string[4]; - TfpgModalResult = Low(integer)..MaxInt; PPoint = ^TPoint; @@ -59,6 +58,10 @@ type TClipboardKeyType = (ckNone, ckCopy, ckPaste, ckCut); + // If you have to convert this to an Integer, mrNone = 0 etc. + TfpgModalResult = (mrNone, mrOK, mrCancel, mrYes, mrNo, mrAbort, mrRetry, + mrIgnore, mrAll, mrNoToAll, mrYesToAll); + const MOUSE_LEFT = 1; MOUSE_RIGHT = 3; @@ -90,19 +93,6 @@ const // The special keys, based on the well-known keyboard scan codes {$I keys.inc} - { TfpgModalResult values } - mrNone = 0; - mrOk = mrNone + 1; - mrCancel = mrOk + 1; - mrYes = mrCancel + 1; - mrNo = mrYes + 1; - mrAbort = mrNo + 1; - mrRetry = mrAbort + 1; - mrIgnore = mrRetry + 1; - mrAll = mrIgnore + 1; - mrNoToAll = mrAll + 1; - mrYesToAll = mrNoToAll + 1; - { Default fpGUI help viewer } FPG_HELPVIEWER = 'docview'; diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index 1136ea0b..a98ff328 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -342,7 +342,7 @@ begin Result := False; frm := TfpgFontSelectDialog.Create(nil); frm.SetFontDesc(FontDesc); - if frm.ShowModal = 1 then + if frm.ShowModal = mrOK then begin FontDesc := frm.GetFontDesc; Result := True; @@ -1228,7 +1228,7 @@ var begin dlg := TfpgNewDirDialog.Create(nil); try - if dlg.ShowModal = 1 then + if dlg.ShowModal = mrOK then begin if dlg.Directory <> '' then begin @@ -1385,7 +1385,7 @@ begin btnOK.ImageName := 'stdimg.open'; // Do NOT localize btnOK.Text := rsOpen; - if ShowModal = 1 then + if ShowModal = mrOK then Result := True else Result := False; @@ -1409,7 +1409,7 @@ begin btnOK.ImageName := 'stdimg.save'; // Do NOT localize btnOK.Text := rsSave; - if ShowModal = 1 then + if ShowModal = mrOK then Result := True else Result := False; diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas index 26d24f0d..254477e6 100644 --- a/src/gui/fpg_form.pas +++ b/src/gui/fpg_form.pas @@ -97,7 +97,7 @@ type procedure InvokeHelp; override; procedure Show; procedure Hide; - function ShowModal: integer; + function ShowModal: TfpgModalResult; procedure Close; function CloseQuery: boolean; virtual; end; @@ -288,7 +288,7 @@ begin HandleShow; end; -function TfpgBaseForm.ShowModal: integer; +function TfpgBaseForm.ShowModal: TfpgModalResult; var lCloseAction: TCloseAction; begin diff --git a/src/gui/messagedialog.inc b/src/gui/messagedialog.inc index f07ec013..10ffd515 100644 --- a/src/gui/messagedialog.inc +++ b/src/gui/messagedialog.inc @@ -170,9 +170,9 @@ var { TODO : At some stage the StyleManager can give us the correct button order based on the OS and Window Manager. } Result := 3; - sl.Add(cMsgDlgBtnText[mbYes] + '=' + IntToStr(mrYes)); - sl.Add(cMsgDlgBtnText[mbNo] + '=' + IntToStr(mrNo)); - sl.Add(cMsgDlgBtnText[mbCancel] + '=' + IntToStr(mrCancel)); + sl.Add(cMsgDlgBtnText[mbYes] + '=' + IntToStr(Integer(mrYes))); + sl.Add(cMsgDlgBtnText[mbNo] + '=' + IntToStr(Integer(mrNo))); + sl.Add(cMsgDlgBtnText[mbCancel] + '=' + IntToStr(Integer(mrCancel))); case DefaultButton of mbYes: lDefault := 0; mbNo: lDefault := 1; @@ -207,7 +207,7 @@ begin b := TfpgButton.Create(self); b.Name := 'DlgButton' + IntToStr(i+1); b.Text := sl.Names[i]; - b.ModalResult := StrToInt(sl.ValueFromIndex[i]); + b.ModalResult := TfpgModalResult(StrToInt(sl.ValueFromIndex[i])); if (i = lDefault) or (lcount = 1) then b.Default := True; FButtonList.Add(b); |