X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aa7a6a0e5caff5e1a678288aee86495a82212b6b..f3793429150870568992e96fedacbdf87c0c3340:/samples/dragimag/dragimag.cpp diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index 557f0a1ef9..31b3f4c2e0 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -368,6 +368,9 @@ MyApp::MyApp() bool MyApp::OnInit() { + if ( !wxApp::OnInit() ) + return false; + #if wxUSE_LIBPNG wxImage::AddHandler( new wxPNGHandler ); #endif @@ -382,15 +385,12 @@ bool MyApp::OnInit() wxString rootName(_T("shape0")); - int i; - for (i = 1; i < 4; i++) + for (int i = 1; i < 4; i++) { - wxString filename; - filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i); /* For some reason under wxX11, the 2nd LoadFile in this loop fails, with a BadMatch inside CreateFromImage (inside ConvertToBitmap). This happens even if you copy the first file over the second file. */ - if (image.LoadFile(filename, wxBITMAP_TYPE_PNG)) + if (image.LoadFile(wxString::Format("%s%d.png", rootName, i), wxBITMAP_TYPE_PNG)) { DragShape* newShape = new DragShape(wxBitmap(image)); newShape->SetPosition(wxPoint(i*50, i*50));