Opened 5 years ago

Closed 4 years ago

#15104 closed defect (fixed)

Print Preview broken with Idle mode wxIDLE_PROCESS_SPECIFIED

Reported by: AxelWagner Owned by: VZ
Priority: low Milestone:
Component: printing Version: 2.9.4
Keywords: idle Cc: juliansmart
Blocked By: Blocking:
Patch: no


If the application is setting the idle mode to wxIDLE_PROCESS_SPECIFIED, the print preview will not display any pages in wxWidgets 2.9.4. The reason is that page rendering is done in idle time, but the wxPreviewCanvas does not receive Idle events if that mode is set.

wxPreviewCanvas should set the wxWS_EX_PROCESS_IDLE extra style in its constructor (if that does not collide with other idle modes). If this is not possible, the documentation should be updated to cover this case.

Workaround in application code: after initializing the preview frame, get the canvas from the preview and set the extra style.

Change History (3)

comment:1 Changed 5 years ago by vadz

  • Cc juliansmart added
  • Keywords idle added
  • Priority changed from normal to low

To be honest I've never understood how does this idle mode changing stuff works so I'd recommend to never changing it in the first place. Perhaps Julian can propose a better workaround or even a solution but personally I'm not ready to dive into exploring this, sorry.

comment:2 Changed 5 years ago by AxelWagner

Well, the workaround is pretty simple, just three lines of additional code, and it works for me:

    wxPreviewFrame* frame = new wxPreviewFrame(preview, parent, title);

    // begin workaround
    wxPreviewCanvas* canvas = preview->GetCanvas();
    if (canvas)
    // end workaround


The correction would shrink to a one-liner if the call to SetExtraStyle() would be moved into the wxPreviewCanvas constructor. But I cannot predict any side effects of setting this flag on library level.

I could live with the workaround, but I guessed that others might run into the same issue, which is not at all easy to track down.

comment:3 Changed 4 years ago by VZ

  • Owner set to VZ
  • Resolution set to fixed
  • Status changed from new to closed

In 76652:

Ensure that wxPreviewCanvas always gets idle event.

Use wxWS_EX_PROCESS_IDLE flag to ensure that the print preview receives idle
events even when wxIDLE_PROCESS_SPECIFIED global idle mode is used.

Closes #15104.

Note: See TracTickets for help on using tickets.