From 4e345e1ceb2183d1fe13597a61c5c209488f0237 Mon Sep 17 00:00:00 2001 From: and3md Date: Tue, 6 Feb 2018 13:50:51 +0100 Subject: [PATCH] Fix setting default filename in FileDialog. --- src/dlangui/dialogs/filedlg.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index 85ee75ef..c3b04465 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -713,6 +713,9 @@ class FileDialog : Dialog, CustomGridCellAdapter { /// override to implement creation of dialog controls override void initialize() { + // remember filename specified by user, file grid initialization can change it + string defaultFilename = _filename; + _roots = getRootPaths() ~ getBookmarkPaths(); layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT).minWidth(WIDGET_STYLE_CONSOLE ? 50 : 600); @@ -821,6 +824,9 @@ class FileDialog : Dialog, CustomGridCellAdapter { openDirectory(_path, _filename); _fileList.layoutHeight = FILL_PARENT; + // set default file name if specified by user + if (defaultFilename.length != 0) + _edFilename.text = toUTF32(baseName(defaultFilename)); } /// get sort order suffix for column title