option editor, warn about unsaved changes on close

This commit is contained in:
Basile Burg 2015-05-20 16:13:47 +02:00
parent 0c1862c9ba
commit 01a15e610f
2 changed files with 16 additions and 0 deletions

View File

@ -7,6 +7,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
Caption = 'Options editor'
ClientHeight = 493
ClientWidth = 559
OnCloseQuery = FormCloseQuery
inherited Back: TPanel
Height = 493
Width = 559

View File

@ -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