We have a model form with a list of reports than can be selected for printing or previewing. Printing is no problem; however, when previewing the report we are instantiating a preview container so that we can change the caption. We also want to dock the toolbar and make sure the preview container is maximized. We are using the NOWAIT clause on the REPORT COMMAND so that we can then dock the toolbar and maximized the preview container. The problem is, instead of waiting for the preview container to close, it opens the next report in the list for previewing. You end up with the last report in the preview container displayed although the other report is open in the container window (but you can't get ot it).
Here is a snipet of the code we are using...
*--- CREATE VARIABLES FOR PREVIEW CONTAINER AND REPORT LISTENER
LOCAL loPC, loRL
*--- CREATE PREVIEW CONTAINER
DO (_REPORTPREVIEW) WITH loPC
*--- SET PREVIEW CONTAINER PROPERTIES
loPC.ZoomLevel = 5 && SET ZOOM TO 100%
loPC.ToolbarIsVisible = .T. && MAKE SURE WE CAN SEE TOOLBAR
*--- INSTANTIATE THE REPORT LISTENER
loRL = CREATEOBJECT("REPORTLISTENER")
*--- CHANGE THE PROPERTIES FOR THE REPORT LISTENER
loRL.PrintJobName = lcPVCaption
*--- ASSIGN THE PREVIEW CONTAINER WITH THE MODIFIED PROPERITIES TO THE REPORT LISTENER
loRL.PreviewContainer = loPC
IF lcOutPutTo = "P"
loRL.ListenerType = 0 && PRINT
ELSE
loRL.ListenerType = 1 && PREVIEW
ENDIF
REPORT FORM (lcFRX) OBJECT loRL NOWAIT
IF lcOutPutTo = "V"
loPC.oForm.ToolBar.Dock(0) && DOCK TOOLBAR
loPC.oForm.Windowstate = 2 && MAXIMIZE PREVIEW WINDOW
ENDIF
This code is a "report" procedure that gets called from the report specification screen.
Can't figure out how to make it wait for the report preview screen to get closed before trying to preview the next report.
John Fatte'
Life is beautiful!