My current code looks something like this (under Win10-64-bit, MSVC Express 2010, wxWidgets 3.02):
Code: Select all
wxString caption = _("Choose a job file");
wxString wildcard = _("Job files (*.wbj)|*.wbj|All files (*.*)|*.*");
if ( wsLastPath.IsEmpty() )
defaultDir = _T(".");
else
defaultDir = wsLastPath;
wxString defaultFilename = wxEmptyString;
wxFileDialog dialog( this, caption, defaultDir, defaultFilename,
wildcard, wxFD_OPEN /*| wxFD_CHANGE_DIR*/ ); <<<<< with or without, no difference
// to avoid some awfully curious Win default behaviour, which nearly
// drove me crazy, one has to call SetPath() before showing the file dialog
// except it DOES NOT WORK!!!!!!
// see: https://forums.wxwidgets.org/viewtopic.php?f=1&t=40711
dialog.SetPath( defaultDir ); <<<<<<<<<<<< does nothing
wxSetWorkingDirectory( defaultDir ); <<<<<<<<<<<< does nothing
if (dialog.ShowModal() != wxID_OK)
{
return false;
}
While this is not fatal, it is more than annoying during development and will be equally frustrating for a user.
How can I force the dialog to open the desired directory every time?
I have seen this issue addressed once on this forum, but I never did find a real solution.
See: viewtopic.php?f=23&t=37856&p=154439&hil ... ry#p154439
Most likely I have missed something, but ....
TIA for any pointers or help