PRB: Report Designer/Preview Needs VFP Desktop to Display

Last reviewed: January 13, 1998
Article ID: Q156237
5.00 WINDOWS kbtool kbui kbprg kbprb

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 5.0

SYMPTOMS

If REPORT FORM <formname> PREVIEW or MODIFY REPORT <formname> is called from an SDI or top-level form (form with the ShowWindow property set to 2), the Report Preview or Report Designer does not appear if the Visual FoxPro desktop is hidden.

WORKAROUND

Make the Visual FoxPro desktop visible (_SCREEN.Visible = .T.) and display the Report Designer or preview and hide the Visual FoxPro desktop (_SCREEN.Visible = .F.) after the Report Designer or Preview has been closed.

STATUS

This behavior is by design.

MORE INFORMATION

The Page Preview and Report Designer windows are being created as a child window of the Visual FoxPro desktop. Since the desktop is not visible, the Page Preview and Report Designer windows cannot be visible. Each of these windows has toolbars that require the Visual FoxPro desktop in order for them to be displayed.

Steps to Reproduce Behavior

  1. Run the following code from a program (.prg) file:

    * Start of code example * PUBLIC oform LOCAL lnI CLOSE ALL CREATE TABLE table_1 (field1 C(10)) FOR lnI=1 TO 3

          INSERT INTO table_1 VALUES ('xx')
    
    ENDFOR

    CREATE REPORT report_1 FROM table_1

    oform=CREATEOBJECT("SDI_form") oform.SHOW() READ EVENTS CLOSE TABLES

    DEFINE CLASS sdi_form AS FORM

          SHOWWINDOW = 2
          AUTOCENTER = .T.
          lIsFormUp=.F.
    

          ADD OBJECT commandpreview AS COMMANDBUTTON WITH ;
    
             TOP = 180, ;
             LEFT = 80, ;
             HEIGHT = 27, ;
             WIDTH = 95, ;
             CAPTION = "Report Preview", ;
             NAME = "Commandpreview"
    
          ADD OBJECT commanddesign AS COMMANDBUTTON WITH ;
             TOP = 180, ;
             LEFT = 202, ;
             HEIGHT = 27, ;
             WIDTH = 95, ;
             CAPTION = "Modify Report", ;
             NAME = "Commanddesign"
    
          PROCEDURE DESTROY
             CLEAR EVENTS
             _SCREEN.VISIBLE=.T.
          ENDPROC
    
          PROCEDURE ACTIVATE
             IF !THIS.lisformup
                _SCREEN.VISIBLE = .F.   && We wait till now to hide desktop
                                        && to ensure SDI form is active window
                THIS.lIsFormUp = .T.
             ENDIF
          ENDPROC
    
          PROCEDURE commandpreview.CLICK
             REPORT FORM report_1 PREVIEW
          ENDPROC
    
          PROCEDURE commanddesign.CLICK
             MODIFY REPORT report_1
          ENDPROC
    
       ENDDEFINE
       *
       * End of code example
    
    

  2. Click on either command button. The preview or Report Designer does not appear.

    NOTE: You may need to double-click the [-] or fox head in the upper left corner to close the form after doing this.

How to Get It Working

  1. Modify the Click procedure code for the two command buttons above to read as follows:

    * Start of code example * PROCEDURE commandpreview.CLICK

          _SCREEN.VISIBLE = .T.           && Show VFP desktop
          KEYBOARD '{ctrl+f10}' CLEAR     && Maximixe Preview window
          REPORT FORM report_1 PREVIEW
          _SCREEN.VISIBLE = .F.           && Hide VFP desktop
       ENDPROC
    
       PROCEDURE commanddesign.CLICK
          LOCAL lcOldShutDown
          lcOldShutDown = ON('shutdown')  && Saves existing ON SHUTDOWN
          ON SHUTDOWN _SCREEN.VISIBLE=.F. && Traps for closing desktop
          _SCREEN.VISIBLE = .T.           && Show VFP desktop
          KEYBOARD '{ctrl+f10}' CLEAR     && Maximixe Designer window
          MODIFY REPORT report_1
          _SCREEN.VISIBLE = .F.           && Hide VFP desktop
          ON SHUTDOWN &lcOldShutDown      && Restores existing ON SHUTDOWN
       ENDPROC
       *
       * End of code example
    
    

  2. Click on either command button. The preview or Report Designer appears. When the preview or Report Designer is closed, the desktop is again hidden and the SDI form regains the focus.


KBCategory: kbtool kbui kbprg kbprb
KBSubcategory: FxtoolFormdes FxtoolReportdes
Additional reference words: 5.00 kbdse VfoxWin print preview
Keywords : FxtoolFormdes FxtoolReportdes kbprb kbprg kbtool kbui
Version : 5.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.