From: Robert Roebling Date: Thu, 1 Jul 1999 12:54:06 +0000 (+0000) Subject: Corrected bug in filedlg. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/53daeadab733c0458a7541efe48c3f86a5444692 Corrected bug in filedlg. Added more stream tests to typetest sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 7acd762b4a..bb345ae8c0 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -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 diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 7513762b20..086a593ef5 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -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; + } } } diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 7513762b20..086a593ef5 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -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; + } } }