diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-11-11 21:27:14 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-11-11 21:27:14 +0200 |
commit | bd7c4ffcd9b8273069c332d50cace2e3e7747bca (patch) | |
tree | ebd2ffcbf5080fe415cb7f2e2f6ebe7c95b4c6b1 /src/gui | |
parent | 316705c596c74e13870f264635740d997f0473e8 (diff) | |
download | fpGUI-bd7c4ffcd9b8273069c332d50cace2e3e7747bca.tar.xz |
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.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpg_dialogs.pas | 12 |
1 files changed, 12 insertions, 0 deletions
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 |