From 4ec763879192e974164252221e1cf862d52a9a07 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 21 Sep 2011 10:37:38 +0200 Subject: SelectFileDialog() can now specify the initial directory too. --- src/gui/fpg_dialogs.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index 62198263..b66f740f 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -235,7 +235,7 @@ procedure ShowMessage(AMessage, ATitle: string; ACentreText: Boolean = False); o procedure ShowMessage(AMessage: string; ACentreText: Boolean = False); overload; function SelectFontDialog(var FontDesc: string): boolean; -function SelectFileDialog(const ADialogType: boolean = sfdOpen; const AFilter: TfpgString = ''): TfpgString; +function SelectFileDialog(const ADialogType: boolean = sfdOpen; const AFilter: TfpgString = ''; const AInitialDir: TfpgString = ''): TfpgString; function SelectDirDialog(const AStartDir: TfpgString = ''): TfpgString; function fpgShowCharMap: TfpgString; function fpgSelectColorDialog(APresetColor: TfpgColor = clBlack): TfpgColor; @@ -375,7 +375,7 @@ begin frm.Free; end; -function SelectFileDialog(const ADialogType: boolean = sfdOpen; const AFilter: TfpgString = ''): TfpgString; +function SelectFileDialog(const ADialogType: boolean = sfdOpen; const AFilter: TfpgString = ''; const AInitialDir: TfpgString = ''): TfpgString; var dlg: TfpgFileDialog; dres: boolean; @@ -389,6 +389,9 @@ begin else dlg.Filter := aFilter+'|'+DefaultFilter; + if AInitialDir <> '' then + dlg.InitialDir := AInitialDir; + if aDialogType = sfdOpen then dres := dlg.RunOpenFile else -- cgit v1.2.3-70-g09d2