diff --git a/source/grideditlinks.pas b/source/grideditlinks.pas index 9b80990d..d9a5a2cd 100644 --- a/source/grideditlinks.pas +++ b/source/grideditlinks.pas @@ -1204,7 +1204,7 @@ procedure TInplaceEditorLink.ButtonClick(Sender: TObject); Editor.SetMaxLength(FMaxLength); Editor.TableColumn := FTableColumn; Editor.MemoText.ReadOnly := not FAllowEdit; - if Editor.ShowModal = mrOk then begin + if Editor.ShowModal = mrYes then begin FEdit.Text := Editor.GetText; DoEndEdit(Sender); end diff --git a/source/texteditor.pas b/source/texteditor.pas index 790fcdf2..1a6b9a11 100644 --- a/source/texteditor.pas +++ b/source/texteditor.pas @@ -86,8 +86,8 @@ TfrmTextEditor = class(TExtForm) private { Private declarations } FModified: Boolean; - FStopping: Boolean; FClosingByApplyButton: Boolean; + FClosingByCancelButton: Boolean; FDetectedLineBreaks, FSelectedLineBreaks: TLineBreaks; FMaxLength: Integer; @@ -430,11 +430,9 @@ procedure TfrmTextEditor.btnLoadTextClick(Sender: TObject); procedure TfrmTextEditor.btnCancelClick(Sender: TObject); -var - Action: TCloseAction; begin - Action := caNone; - FormClose(Self, Action); + FClosingByCancelButton := True; + Close; end; @@ -501,20 +499,15 @@ procedure TfrmTextEditor.menuFormatCodeOnceClick(Sender: TObject); procedure TfrmTextEditor.FormClose(Sender: TObject; var Action: TCloseAction); -var - DoPost: Boolean; begin - if FStopping then - Exit; - FStopping := True; - if Modified and FClosingByApplyButton then - DoPost := True - else if Modified then - DoPost := MessageDialog(_('Apply modifications?'), mtConfirmation, [mbYes, mbNo]) = mrYes - else - DoPost := False; - if DoPost then - ModalResult := mrOk + if Modified then begin + if FClosingByCancelButton then + ModalResult := mrCancel + else if FClosingByApplyButton then + ModalResult := mrYes + else + ModalResult := MessageDialog(_('Apply modifications?'), mtConfirmation, [mbYes, mbNo]); + end else ModalResult := mrCancel; end;