Discussion:
wxRichTextPrinting::PreviewBuffer
Eric Jensen
2014-05-03 10:37:35 UTC
Permalink
Hi.

I just noticed that wxRichTextPrinting::PreviewBuffer returns
immediately. As it displays a preview frame that looks like a modal
dialog and also behaves like one, i would have expected that this call
only returns after the preview window was closed by the user.

Is that intentional?

The reason i'm asking is, that i expected this method to return true
when the document was printed and false when not. But the way it is
now, i don't know if the document was printed at all. I'd like to know
this in order to update my global wxPageSetupDialogData instance with
the (eventually changed) data.

Eric
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Eric Jensen
2014-05-03 11:56:28 UTC
Permalink
EJ> I just noticed that wxRichTextPrinting::PreviewBuffer returns
EJ> immediately. As it displays a preview frame that looks like a modal
EJ> dialog and also behaves like one, i would have expected that this call
EJ> only returns after the preview window was closed by the user.

EJ> Is that intentional?

EJ> The reason i'm asking is, that i expected this method to return true
EJ> when the document was printed and false when not. But the way it is
EJ> now, i don't know if the document was printed at all. I'd like to know
EJ> this in order to update my global wxPageSetupDialogData instance with
EJ> the (eventually changed) data.

Commenting myself:

Apparently the behavior is documented in
wxPrintPreview/wxPreviewFrame, so i guess it's intentional.

But this causes a few problems. In my case i want to print an image
rotated by 90 degrees using wxHtmlEasyPrinting. My plan was to create
a temporary copy of the rotated wxImage, store it in memory using
wxMemoryFSHandler, show the preview dialog (and give the user the
chance to print it) and remove it afterwards. This doesn't work if the
call to wxHtmlEasyPrinting::PreviewText returns immediately.

I don't see any clean solution for this with the current
implementation. I think at the very least, wxPreviewFrame should send
an event to the parent if the user closed it, ideally transferring the
information whether the content was successfully printed or not.

Eric
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-05-03 17:13:13 UTC
Permalink
On Sat, 3 May 2014 13:56:28 +0200 Eric Jensen wrote:

EJ> But this causes a few problems. In my case i want to print an image
EJ> rotated by 90 degrees using wxHtmlEasyPrinting. My plan was to create
EJ> a temporary copy of the rotated wxImage, store it in memory using
EJ> wxMemoryFSHandler, show the preview dialog (and give the user the
EJ> chance to print it) and remove it afterwards. This doesn't work if the
EJ> call to wxHtmlEasyPrinting::PreviewText returns immediately.

There is a possibility to show wxPreviewFrame modally using its
InitializeWithModality() method, but wxHtmlEasyPrinting doesn't provide
access to it, unfortunately.

EJ> I don't see any clean solution for this with the current
EJ> implementation.

I think you should be able to just Bind() to wxEVT_CLOSE or wxEVT_DESTROY
of the frame returned by wxPrintPreview::GetFrame() to be notified about
the frame being closed.

EJ> I think at the very least, wxPreviewFrame should send an event to the
EJ> parent if the user closed it, ideally transferring the information
EJ> whether the content was successfully printed or not.

This could be probably added.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Loading...