From 9604c729bf0939669cc6f19ab65d9402afdda2af Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 21 Sep 2021 01:00:07 +0200 Subject: [PATCH] Update the shown file name in wxGTK wxFilePickerCtrl::SetPath() This still doesn't work if the file doesn't exist, but at least shows the correct file name if it does exist, which is better than nothing and the best we can reasonably do when using the native control. Closes #19163. --- src/gtk/filepicker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp index 600a785cb1..bdc03f80b2 100644 --- a/src/gtk/filepicker.cpp +++ b/src/gtk/filepicker.cpp @@ -135,7 +135,9 @@ void wxFileButton::SetPath(const wxString &str) { m_path = str; - if (m_dialog) + if (GTK_IS_FILE_CHOOSER(m_widget)) + gtk_file_chooser_set_filename((GtkFileChooser*)m_widget, str.utf8_str()); + else if (m_dialog) UpdateDialogPath(m_dialog); }