Opened 12 years ago

Closed 11 years ago

#10341 closed defect (fixed)

wxHtmlEasyPrinting::PreviewFile window at background under wxGTK2

Reported by: beckerde Owned by:
Priority: normal Milestone:
Component: wxHtml Version: 2.8.9
Keywords: wxHtmlEasyPrinting preview Cc:
Blocked By: Blocking:
Patch: yes

Description

wxHtmlEasyPrinting::PreviewFile window is shown at background when the parent window is a wxDialog derived class under wxGTK2. So, when the parent window is a large one, it hides the wxPreviewFrame window. If I move the parent window and click on the preview window it does not come to the foreground.
The solution I found is to set the style of the created wxPreviewFrame window to
wxDEFAULT_FRAME_STYLE|wxFRAME_FLOAT_ON_PARENT in the wxHtmlEasyPrinting::DoPreview function, in src/html/htmprint.cpp file.
DoPreview function should also test if member m_ParentWindow is given, and set it to ::GetActiveWindow() if it was null (not given by the user, something common when using dialogs).

Attachments (1)

elparche.diff download (785 bytes) - added by beckerde 12 years ago.
diff with the patch

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by beckerde

diff with the patch

comment:1 Changed 12 years ago by beckerde

  • Keywords wxHtmlEasyPrinting preview added

comment:2 follow-up: Changed 12 years ago by vadz

  • Resolution set to port to stable
  • Status changed from new to portneeded

I've applied the first part of the patch as r58154 but not at wxHtmlEasyPrinting level as it doesn't seem to be wxHTML-specific at all -- instead I changed the default style used by wxPreviewFrame itself.

As for the second one (using wxGetActiveWindow) I'm not sure it's the right thing to do, if do want to allow passing NULL parent here we should rather refactor wxDialog::GetParentForModalDialog() and use it again in wxPreviewFrame itself.

If no problems are found, this can be backported to stable later.

comment:3 in reply to: ↑ 2 Changed 12 years ago by beckerde

Replying to vadz:

I've applied the first part of the patch as r58154 but not at wxHtmlEasyPrinting level as it doesn't seem to be wxHTML-specific at all -- instead I changed the default style used by wxPreviewFrame itself.

You're right about this, it's better to put it there, in the prntbase.h file.

As for the second one (using wxGetActiveWindow) I'm not sure it's the right thing to do, if do want to allow passing NULL parent here we should rather refactor wxDialog::GetParentForModalDialog() and use it again in wxPreviewFrame itself.

No problem, I know that if I don't give a parent window I will have trouble.
Maybe a comment about this in the wxHtmlEasyPrinting::PreviewFile documentation is enough.

If no problems are found, this can be backported to stable later.

Many thanks !

comment:4 Changed 11 years ago by VZ

  • Resolution changed from port to stable to fixed
  • Status changed from portneeded to closed

(In [62502]) Make the preview frame float on parent by default.

Otherwise it is hidden when the parent is a modal dialog, at least under
wxGTK.

This is a backport of r58154 from trunk and closes #10341.

Note: See TracTickets for help on using tickets.