mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
FIX: key ESC/RETURN handled in Options Dialog & KasPathEdit (#880)
* FIX: key ESC/RETURN handled in Options Dialog & KasPathEdit * FIX: FormCloseQuery only when key ESCAPE in Options Dialog
This commit is contained in:
parent
2d04c4b609
commit
0d1d537121
3 changed files with 19 additions and 22 deletions
|
|
@ -453,10 +453,15 @@ begin
|
|||
Key:= 0;
|
||||
end else begin
|
||||
if Key=VK_ESCAPE then begin
|
||||
if Assigned(onKeyESCAPE) then onKeyESCAPE( self );
|
||||
if Assigned(onKeyESCAPE) then begin
|
||||
onKeyESCAPE( self );
|
||||
Key:= 0;
|
||||
end;
|
||||
end else begin
|
||||
if Assigned(onKeyRETURN) then onKeyRETURN( self );
|
||||
Key:= 0;
|
||||
if Assigned(onKeyRETURN) then begin
|
||||
onKeyRETURN( self );
|
||||
Key:= 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -151,10 +151,11 @@ object frmOptions: TfrmOptions
|
|||
AutoSize = True
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Cancel = True
|
||||
Caption = '&Cancel'
|
||||
Kind = bkCancel
|
||||
ModalResult = 2
|
||||
OnClick = btnCancelClick
|
||||
OnMouseDown = btnCancelMouseDown
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnApply: TBitBtn
|
||||
|
|
@ -779,12 +780,4 @@ object frmOptions: TfrmOptions
|
|||
1D14CA2287977319F2E70F4F81E18A95C2FF03529B5370
|
||||
}
|
||||
end
|
||||
object alOptionsActionList: TActionList
|
||||
Left = 72
|
||||
Top = 80
|
||||
object actCloseWithEscape: TAction
|
||||
OnExecute = actCloseWithEscapeExecute
|
||||
ShortCut = 27
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ type
|
|||
TreeFilterEdit: TTreeFilterEdit;
|
||||
tvTreeView: TTreeView;
|
||||
splOptionsSplitter: TSplitter;
|
||||
alOptionsActionList: TActionList;
|
||||
actCloseWithEscape: TAction;
|
||||
procedure btnCancelClick(Sender: TObject);
|
||||
procedure btnCancelMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure btnHelpClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
|
|
@ -77,7 +77,6 @@ type
|
|||
function TreeFilterEditFilterItem(ItemData: Pointer;
|
||||
out Done: Boolean): Boolean;
|
||||
procedure tvTreeViewChange(Sender: TObject; Node: TTreeNode);
|
||||
procedure actCloseWithEscapeExecute(Sender: TObject);
|
||||
private
|
||||
FOptionsEditorList: TOptionsEditorViews;
|
||||
FOldEditor: TOptionsEditorView;
|
||||
|
|
@ -225,6 +224,13 @@ begin
|
|||
CanClose := (ModalResult in [mrOK, mrCancel]) or CycleThroughOptionEditors(False);
|
||||
end;
|
||||
|
||||
procedure TfrmOptions.btnCancelMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
// set ModalResult when mouse click, to pass FormCloseQuery
|
||||
ModalResult:= mrCancel;
|
||||
end;
|
||||
|
||||
procedure TfrmOptions.btnCancelClick(Sender: TObject);
|
||||
begin
|
||||
// close window
|
||||
|
|
@ -574,13 +580,6 @@ begin
|
|||
TreeFilterEdit.StoreSelection;
|
||||
end;
|
||||
|
||||
{ TfrmOptions.actCloseWithEscapeExecute }
|
||||
procedure TfrmOptions.actCloseWithEscapeExecute(Sender: TObject);
|
||||
begin
|
||||
// Closing with the "Escape" key this way won't set the modalresult to mrCancel so this way, if an unsaved modification has been made, we'll be able to prompt confirmation from user who attempt to quit by hitting "Escape".
|
||||
close;
|
||||
end;
|
||||
|
||||
finalization
|
||||
FreeAndNil(OptionsSearchCache);
|
||||
FreeAndNil(OptionsSearchFile);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue