Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to test if report preview window is visible

Status
Not open for further replies.

samsnead

Programmer
Sep 3, 2005
100
CA
We have a report that prints multiple "reports" using scan endscan. We have created an exitpreview button that will exit the scan when clicked. However, if you click at wrong time (while the preview is being generated) you sometimes get an error message with options to try again don't try or cancel *Yes, No, Cancel). Cancel works ok and goes back to program.

Since we have novice users that will click the exitpreview at will, we want to disable that button until the report preview window or toolbar is displayed. Is there an easy way to detect this?
 
Unless you use the NOWAIT clause you won't get to the statement following "REPORT FORM" until the preview window is closed. So I suggest:

THISFORM.button1.ENABLED = .F.
REPORT FORM ..... PREVIEW
THISFORM.button1.ENABLED = .T.

Jim
 
Hi Jim - that almost works but because in a scan loop, quickly gets back to the THISFORM.button1.ENABLED = .F.
I would like to disable the button (in when of click) when the preview is visible. It is VFP9 so there probably is a reportpreview property that I can check. Just trying to find it.
 
Thx Geoff - for some reason that didn;t work (although it should). I ended up putting in this code in the when of the command on my exitpreview toolbar and now is ok.
FOR nCount = 1 TO _SCREEN.FormCount
IF UPPER(_SCREEN.Forms(nCount).Name)="PREVIEWTOOLBAR"
llrval=.T.
RETURN .T.

ENDIF
ENDFOR

at least until testers test it !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top