trap print preview | run method

For one-off letters, I have the users type the letter in a FID, then when they press ‘Print’ they go to a print layout and view the preview:

forms.cncm_com_letterprint.controller.showPrintPreview(true)

But their most recent modifications will not show in the preview so I added a commit:

databaseManager.commitTransaction()
forms.cncm_com_letterprint.controller.showPrintPreview(true)

Okay, sort-of, but then when they are done they are dropped off at the calling (main) form. Sometimes people will see the letter in preview and want to modify. If I add to the above two lines the following:

databaseManager.startTransaction()
application.showFormInDialog(forms.cncm_com_letter 265,28,466,732,
‘Letter Composer’,false,true,true)

… then the FID pops up in front of the print preview. Apparently, these two lines of the method don’t hang around awaiting the close of the preview, but just spring boldly into action, so that won’t do. They need to be triggered as a separate method upon close of the print preview.

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)?

[Even better would be to not have to commit the transaction until the user sees the preview. In such a case, either 'Print" or ‘Close’ would return the user to the FID, wherein they could choose to save, modify, or cancel. But I imagine that this may only be possible if/when we have stackable FIDs.]

Ideas appreciated!

Thanks,

Jim Schliestett