X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6adaedf0fc6607ee5bb4e86358396e5e07c6649f..00f34af5706e4ff61a595ad13b4400591da79e2a:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 04d721a4af..45703a7f3d 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -104,12 +104,14 @@ bool MyApp::OnInit(void) file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup"); file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview"); +#if wxUSE_ACCEL // Accelerators wxAcceleratorEntry entries[1]; entries[0].Set(wxACCEL_CTRL, (int) 'V', WXPRINT_PREVIEW); wxAcceleratorTable accel(1, entries); frame->SetAcceleratorTable(accel); - +#endif + #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW file_menu->AppendSeparator(); file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)"); @@ -190,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();