]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/filedlg.cpp
more backwards compatible kbd handling in wxScrolledWindow
[wxWidgets.git] / src / msw / filedlg.cpp
index ba1869e1c52ce58383befaa84b76e11a5e7b250b..a96c48e52b7964b828103b41b1c18784cb7c598e 100644 (file)
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
+#include "wx/msw/private.h"
 
 #ifdef __BORLANDC__
     #pragma hdrstop
 #endif
 
 #ifndef WX_PRECOMP
-    #include <stdio.h>
-    #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 <windows.h>
+//    #include "wx/msw/private.h"
+#endif
 
 #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__)
     #include <commdlg.h>
 #endif
 
-#include "wx/msw/private.h"
-
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
-#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 +294,7 @@ int wxFileDialog::ShowModal()
     }
 
     of.lpstrFilter  = (LPTSTR)(const wxChar *)filterBuffer;
-    of.nFilterIndex = m_filterIndex;
+    of.nFilterIndex = m_filterIndex + 1;
 
     //=== Setting defaultFileName >>=========================================
 
@@ -358,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: