#19163: wxFilePickerCtrl::SetPath() doesn't update the displayed path with wxGTK
--------------------+--------------------
Reporter: vadz | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.1.5
Keywords: | Blocked By:
Blocking: | Patch: 0
--------------------+--------------------
As [
https://stackoverflow.com/questions/67267750/wxfilepickerctrl-not-
actualizing-widget-after-setting-path reported on SO], calling
`wxFilePickerCtrl::SetPath()` doesn't update the path displayed by the
control in wxGTK. This can be seen with e.g. just
{{{
#!diff
diff --git a/samples/widgets/filepicker.cpp
b/samples/widgets/filepicker.cpp
index
8706743858..3dfb72f902 100644
--- a/samples/widgets/filepicker.cpp
+++ b/samples/widgets/filepicker.cpp
@@ -300,6 +300,7 @@ void
FilePickerWidgetsPage::OnButtonSetDir(wxCommandEvent& WXUNUSED(event))
void FilePickerWidgetsPage::OnButtonReset(wxCommandEvent&
WXUNUSED(event))
{
+ m_filePicker->SetPath("/tmp/foo"); return;
Reset();
RecreatePicker();
}}}
and pressing "Reset".
I hoped
{{{
#!diff
diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp
index 600a785cb1..a9e42f0993 100644
--- a/src/gtk/filepicker.cpp
+++ b/src/gtk/filepicker.cpp
@@ -135,6 +135,8 @@ void wxFileButton::SetPath(const wxString &str)
{
m_path = str;
+ if (GTK_IS_FILE_CHOOSER(m_widget))
+ gtk_file_chooser_set_filename((GtkFileChooser*)m_widget,
str.utf8_str());
if (m_dialog)
UpdateDialogPath(m_dialog);
}
}}}
would fix it, but it doesn't seem to have any effect and I don't know why
nor what else could we do here.
--
Ticket URL: <
https://trac.wxwidgets.org/ticket/19163>