trap print preview | run method [simplified post]

< logorrhea mode off >

Any way to trap for the disposition of the print preview (i.e. 'Print" or ‘Close’), and then run a method accordingly? How about just running a method upon close of the print preview (without trapping and branching)?

Jim

Would be very handy indeed, and in the past asked a lot of times on the forum. Don’t know if anyone filled in this feauture request in the support solution.

I suppose you are not talking of ‘application.isLastPrintPreviewPrinted’ ?.

Marcel, ‘application.isLastPrintPreviewPrinted’ looks like it goes part of the way to solving this problem, but not far enough.

I am looking for a way to fire a method after closing the print preview, and preferably be able to fire off different methods whether the disposition of the preview was ‘Print’ or ‘Close’.

‘application.isLastPrintPreviewPrinted’ depends on running a method onShow on the originating form. There are likely to be other things happening onShow, and any attempt to fit within it a conditional branch based on a global will fall into the ‘kludge’ category, as I see it.

Further, if the print method is called from a FID, one will not return to the FID after exiting PrintPreview, but to the form that called the FID. If that form (perhaps the ‘main’ form) has many instances of FIDS that are called from it, each with printing possibilities, the onShow on the main form becomes very complex if it is to attempt to utilize ‘application.isLastPrintPreviewPrinted’ for each of them.

Jim

Well, just because you don’t like the way it works (I absolutely see what you say and I agree btw) can’t be the reason not to use it. I would end up not using anything I didn’t build :)

As for the other issue you describe, the global can ofcourse have any value. String, integer etc. I for one use different integers for different uses. One of them is the situation with the FID that you describe.

So, to keep it in your wording: I partially agree, it is just a different part ;)

You are quite right that “just because you don’t like the way it works can’t be the reason not to use it”.

However, it seems that no matter how I set it up, the onShow for the main form is being triggered BEFORE the PrintPreview can be viewed and acted upon.

From the letter form-in-dialog (FID), the print method is:

databaseManager.commitTransaction()
globals.showPrintPreview = 1
forms.cncm_com_letterprint.controller.showPrintPreview(true)

The result is that the onShow method runs from the main form, before the user can view the preview and act (‘Print’ or ‘Close’). Not the desired effect!

I tried running the print method directly from the main form, as an experiment. In this case, the onShow method in the main form ran- as expected- AFTER dismissing the PrintPreview. But of course it is of no help to insert a ‘go to main form’ line in the print method, as THAT will naturally cause the onShow to trigger.

My conclusion is that it does not appear that ‘application.isLastPrintPreviewPrinted’ is of any use when the print method is called from a FID. Why? Because ‘application.isLastPrintPreviewPrinted’ is invoked from the onShow of the original (destination) form, and moving from a FID to PrintPreview necessarily invokes that onShow (as the FID closes, and before the PrintPreview is accessible).

If you can imagine a way to use ‘application.isLastPrintPreviewPrinted’ when the calling method for the PrintPreview lives on a FID, please please let me know.

Thanks,

Jim

Why not in the onclose event of the FID

globals.LastCalledFID = getFormName

and in the onshow of the main

case(LastCalledFID) of
“FIDName”:
test PrintPreview
“AnotherFIDName”:

hth