ugh. Nesting the (per class) plugin sentries can require them to
[wxWidgets.git] / samples / printing / printing.cpp
index bdc779878e15de472b8a2eba5245cabd64b2a57e..45703a7f3d61e3a35628cce8a54cd367e7264e25 100644 (file)
@@ -192,7 +192,12 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
     wxPrinter printer(& printDialogData);
     MyPrintout printout("My printout");
     if (!printer.Print(this, &printout, TRUE))
-        wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
+    {
+        if (wxPrinter::GetLastError() == wxPRINTER_ERROR)
+            wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
+        else
+            wxMessageBox("You canceled printing", "Printing", wxOK);
+    }
     else
     {
         (*g_printData) = printer.GetPrintDialogData().GetPrintData();