wxPrintDialog always returns wxID_CANCEL on Linux

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
ButtonPolisher
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Jun 30, 2021 3:22 am

wxPrintDialog always returns wxID_CANCEL on Linux

Post by ButtonPolisher »

Hello,

To reproduce this, change the "printing" sample OnPrint() method body to the following:

Code: Select all

    wxPrintDialogData printDialogData(* g_printData);

    wxPrintDialog dialog(this, &printDialogData);

    auto result = dialog.ShowModal();

    if (result == wxID_OK)
        wxMessageBox("wxID_OK");
    else if (result == wxID_CANCEL)
        wxMessageBox("wxID_CANCEL");
    else
        wxMessageBox("Something else.");
On Ubuntu Linux 20.04, when I compile/run the sample, select "File/Print...", then select "Print to file" printer, and then press the green "Print" button in the dialog, it returns "wxID_CANCEL".

The wxWidgets version is 3.2.1.

Maybe I am missing something when initializing the dialog?
Post Reply