From bd7c4ffcd9b8273069c332d50cace2e3e7747bca Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 11 Nov 2010 21:27:14 +0200 Subject: File Open/Save dialog now reacts to ENTER key press Another one of those annoyances I had to fix. When I enter a file name to save and want to press ENTER to save and close the dialog. --- src/gui/fpg_dialogs.pas | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/gui') diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index a190cf43..df842257 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -192,6 +192,7 @@ type procedure btnGoHomeClicked(Sender: TObject); procedure btnBookmarkClicked(Sender: TObject); procedure edFilenameChanged(Sender: TObject); + procedure edFilenameKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); procedure UpdateButtonState; function HighlightFile(const AFilename: string): boolean; function CreatePopupMenu: TfpgPopupMenu; @@ -1180,6 +1181,7 @@ begin Text := ''; FontDesc := '#Edit1'; OnChange := @edFilenameChanged; + OnKeyPress := @edFilenameKeyPressed; end; { Filter section } @@ -1358,6 +1360,16 @@ begin UpdateButtonState; end; +procedure TfpgFileDialog.edFilenameKeyPressed(Sender: TObject; + var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); +begin + if KeyCode = keyReturn then + begin + Consumed := True; + btnOK.Click; + end; +end; + procedure TfpgFileDialog.UpdateButtonState; begin if FOpenMode then -- cgit v1.2.3-70-g09d2