]> git.saurik.com Git - wxWidgets.git/commitdiff
Corrected bug in filedlg.
authorRobert Roebling <robert@roebling.de>
Thu, 1 Jul 1999 12:54:06 +0000 (12:54 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 1 Jul 1999 12:54:06 +0000 (12:54 +0000)
  Added more stream tests to typetest sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/typetest/typetest.cpp
src/gtk/filedlg.cpp
src/gtk1/filedlg.cpp

index 7acd762b4a73278c623314eef44b65287567e2ff..bb345ae8c08575c10ad7e509faf6c119cec367ee 100644 (file)
@@ -43,6 +43,7 @@
 #endif
 
 #include "wx/wfstream.h"
+#include "wx/datstrm.h"
 
 
 // Create a new application object
@@ -191,6 +192,57 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
     file_input >> str;
     tmp.Printf( "String: %s\n", str.c_str() );
     textCtrl.WriteText( tmp );
+    
+
+    textCtrl << "\nTest for wxDataStream:\n\n";
+
+    textCtrl.WriteText( "Writing to wxDataOutputStream:\n" );
+    
+    file_output.SeekO( 0 );
+    wxDataOutputStream data_output( file_output );
+
+    wxInt32 i32 = 0xFFFFFFFF;
+    tmp.Printf( "Signed int32: %d\n", i32 );
+    textCtrl.WriteText( tmp );
+    data_output.Write32( i32 );
+    
+    wxUint32 ui32 = 0xFFFFFFFF;
+    tmp.Printf( "Unsigned int32: %u\n", ui32 );
+    textCtrl.WriteText( tmp );
+    data_output.Write32( ui32 );
+    
+    d = 2.01234567890123456789;
+    tmp.Printf( "Double: %f\n", d );
+    textCtrl.WriteText( tmp );
+    data_output.WriteDouble( d );
+    
+    str = "Hello!";
+    tmp.Printf( "String: %s\n", str.c_str() );
+    textCtrl.WriteText( tmp );
+    data_output.WriteString( str );
+    
+    file_output.OutputStreamBuffer()->FlushBuffer();
+    
+    textCtrl.WriteText( "\nReading from wxDataInputStream:\n" );
+    
+    file_input.SeekI( 0 );
+    wxDataInputStream data_input( file_input );
+
+    i32 = data_input.Read32();
+    tmp.Printf( "Signed int32: %d\n", i32 );
+    textCtrl.WriteText( tmp );
+    
+    ui32 = data_input.Read32();
+    tmp.Printf( "Unsigned int32: %d\n", ui32 );
+    textCtrl.WriteText( tmp );
+
+    d = data_input.ReadDouble();
+    tmp.Printf( "Double: %f\n", d );
+    textCtrl.WriteText( tmp );
+    
+    str = data_input.ReadString();
+    tmp.Printf( "String: %s\n", str.c_str() );
+    textCtrl.WriteText( tmp );
 }
 
 #if wxUSE_UNICODE
index 7513762b20d3ea6b43f7662d65ce7cae4ed04c3d..086a593ef5c586f71864efcd15969c33cd58980d 100644 (file)
@@ -165,7 +165,11 @@ void wxFileDialog::SetPath(const wxString& path)
     {
         wxString ext;
         wxSplitPath(path, &m_dir, &m_fileName, &ext);
-        m_fileName += ext;
+       if (!ext.IsEmpty())
+       {
+           m_fileName += _T(".");
+            m_fileName += ext;
+       }
     }
 }
 
index 7513762b20d3ea6b43f7662d65ce7cae4ed04c3d..086a593ef5c586f71864efcd15969c33cd58980d 100644 (file)
@@ -165,7 +165,11 @@ void wxFileDialog::SetPath(const wxString& path)
     {
         wxString ext;
         wxSplitPath(path, &m_dir, &m_fileName, &ext);
-        m_fileName += ext;
+       if (!ext.IsEmpty())
+       {
+           m_fileName += _T(".");
+            m_fileName += ext;
+       }
     }
 }