From 4c4c9631aa60f562a4552d1ec9426ab38bb292f6 Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Thu, 14 Mar 2024 19:54:23 +0100 Subject: [PATCH] TFilenameEdit: adjust InitialDir after user executes the dialog. This is analogue to how TOpenDialog behaves. --- lcl/editbtn.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index 38833741ad..bb03db325f 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -1506,10 +1506,15 @@ end; procedure TFileNameEdit.RunDialog; var D: TCommonDialog; + Res: Boolean; begin D := CreateDialog(DialogKind); try - if D.Execute then + Res := D.Execute; + //this is analogue to how TOpenDialog behaves, InitialDir is retrieved from the dialog, even if user cancels the dialog. + if (D is TOpenDialog) then + InitialDir := TOpenDialog(D).InitialDir; + if Res then SaveDialogResult(DialogKind, D); finally D.Free;