X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f177c8e7309c8cf3ece1563870d135cc8f0e6a1..d4aa3a4b860a70c27421411fbc778fc5914f1815:/src/msw/filedlg.cpp diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 7ec54aecf3..a96c48e52b 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -15,6 +15,7 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/msw/private.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -28,7 +29,7 @@ #include "wx/intl.h" #include "wx/log.h" - #include "wx/msw/private.h" +// #include "wx/msw/private.h" #endif #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) @@ -293,7 +294,7 @@ int wxFileDialog::ShowModal() } of.lpstrFilter = (LPTSTR)(const wxChar *)filterBuffer; - of.nFilterIndex = m_filterIndex; + of.nFilterIndex = m_filterIndex + 1; //=== Setting defaultFileName >>========================================= @@ -354,9 +355,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: