Is there a way to determine in a method containing a Print Preview command if the user has clicked the Cancel button?
Do you mean Close button?, and why whould you like to now?
Sorry, yes, I mean the “Close” button. I want to have the user select various invoices from a table form. Then the user selects a Print function that will present a preview of each invoice for the selected items, the user then will either print or close the print preview and go on the next selected invoice. If the invoice was printed, I want to update a status field to “Printed”, if the Close button was used, no update.
It not possible for Servoy to know if the user did actually print something, the user for example could have pressed cancel in the OS print dialog or the print may have failed in the printqueue
Jan…
The printqueue case I understand. But isn’t there some way to get a returned status from the OS if the ‘cancel’ button is clicked? Filemaker does this and we use the function extensively in our accounting solution during various ‘posting’ processes.
In Servoy 2.2 rc3 it will be possible to test with application.isLastPrintPreviewPrinted()
(check the method sample code voor details/more info)
Wonderfull!!
Does this also work with the normal Print-method?
Can we check this also, if this print is printed?
HJK:
Can we check this also, if this print is printed?
Normal print method? from javascript you know if you did print…
ah oke, it just a check if they pushed the Print-button, not if they pressed the cancel button in the printerdialog!
Works for me!
Thanks.
In Servoy 2.2 rc3 it will be possible to test with application.isLastPrintPreviewPrinted()
Thanks very much! Is there any schedule for RC3 release? (weeks or days?)
Servoy 2.2rc3 will likly be released this week
Jan…
(1) Is HJK’s comment correct–the new isLastPrintPreviewPrinted function is only looking at whether the user clicked ‘Print’ before clicking ‘Close’ within the Servoy PrintPreview window, and is not (also) reflecting the user cllicking ‘Print’ vs. ‘Cancel’ in the OS print dialog, ala Filemaker? If so, this is better than nothing, but only half a solution. In my experience, users consider the OS print dialog to be part of the application, and expect clicking ‘Cancel’ to affect application operation.
Going back to our specific case, we have many places where our app has to print audit reports before the user can close accounting periods, post ledger entries, and so on. The user should only get a 'Would you llike to post now?" prompt if they, in fact, clicked ‘Print’ and not ‘Cancel’ in the Print Dialog, because the goal is to prevent posting if they elected to cancel printing. This is a pretty significant issue for us, and would expect, for many others.
(2) When you say “Normal print method? from javascript you know if you did print…” do you mean you know that you executed the print function because it’s in your method, or that there is some way to get a return code, ala Filemaker?
In RC3 the “onShow” and “onHide” events of the form in printPreview WILL fire. You can then trap for application.isLastPrintPreviewPrinted() in your onHide method.
This should solve all the issues mentioned here.
Bob…just to clarify, is the following true? application.isLastPrintPreviewPrinted() will return ‘false’ if the user has clicked ‘Cancel’ in the OS print-dialog, as well as if the user has clicked ‘Close’ without clicking ‘Print’ in the Servoy print preview window.
Yep - as per STEVE’S REQUEST.