diff --git a/src/ce_optionseditor.lfm b/src/ce_optionseditor.lfm index 3b050c93..5922b1d1 100644 --- a/src/ce_optionseditor.lfm +++ b/src/ce_optionseditor.lfm @@ -7,6 +7,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget Caption = 'Options editor' ClientHeight = 493 ClientWidth = 559 + OnCloseQuery = FormCloseQuery inherited Back: TPanel Height = 493 Width = 559 diff --git a/src/ce_optionseditor.pas b/src/ce_optionseditor.pas index 8666407b..d7fefbaa 100644 --- a/src/ce_optionseditor.pas +++ b/src/ce_optionseditor.pas @@ -33,6 +33,7 @@ type selCat: TTreeView; procedure btnAcceptClick(Sender: TObject); procedure btnCancelClick(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); procedure inspectorEditorFilter(Sender: TObject; aEditor: TPropertyEditor; var aShow: boolean); procedure inspectorModified(Sender: TObject); @@ -204,6 +205,20 @@ begin .optionedEvent(oeeCancel); end; +procedure TCEOptionEditorWidget.FormCloseQuery(Sender: TObject; + var CanClose: boolean); +begin + if fCatChanged then + begin + CanClose := dlgOkCancel( + 'The modifications of the current category are not validated, ' + + 'discard them and continue ?' ) = mrOk; + if CanClose then + btnCancelClick(nil); + end + else CanClose := true; +end; + procedure TCEOptionEditorWidget.inspectorEditorFilter(Sender: TObject;aEditor: TPropertyEditor; var aShow: boolean); begin