X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c61f4f6dbd971245f694eb01034c86040a44db00..06298235850b7e576ef77a9a95b521534f18a4d9:/src/msw/filedlg.cpp diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index ba1869e1c5..17612e6fca 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -21,31 +21,27 @@ #endif #ifndef WX_PRECOMP - #include - #include "wx/defs.h" #include "wx/utils.h" #include "wx/msgdlg.h" #include "wx/dialog.h" #include "wx/filedlg.h" #include "wx/intl.h" #include "wx/log.h" -#endif -#include + #include "wx/msw/private.h" +#endif #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) #include #endif -#include "wx/msw/private.h" - #include #include #include -#if !USE_SHARED_LIBRARY - IMPLEMENT_CLASS(wxFileDialog, wxDialog) -#endif +#include "wx/tokenzr.h" + +IMPLEMENT_CLASS(wxFileDialog, wxDialog) wxString wxFileSelector(const wxChar *title, const wxChar *defaultDir, @@ -297,7 +293,7 @@ int wxFileDialog::ShowModal() } of.lpstrFilter = (LPTSTR)(const wxChar *)filterBuffer; - of.nFilterIndex = m_filterIndex; + of.nFilterIndex = m_filterIndex + 1; //=== Setting defaultFileName >>========================================= @@ -358,9 +354,9 @@ int wxFileDialog::ShowModal() //=== Adding the correct extension >>================================= - m_filterIndex = (int)of.nFilterIndex; + m_filterIndex = (int)of.nFilterIndex - 1; - if ( of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != wxT('.') ) + if ( !of.nFileExtension || (of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != wxT('.')) ) { // user has typed an filename // without an extension: