Help and Support
 

powered byLive Search

How to display the Print Preview window in a top-level form in Visual FoxPro

Article ID:188887
Last Review:February 12, 2007
Revision:2.4
This article was previously published under Q188887
On This Page

SUMMARY

Visual FoxPro version 6.0 has added the IN WINDOW clause to make it easier to display the Print Preview window in a top-level form.

Back to the top

MORE INFORMATION

In Visual FoxPro version 5.0, it is not possible to enable the Print Preview to display in a top-level form. The Print Preview window is always displayed in the Visual FoxPro desktop, which is not usually displayed with a top-level form. Visual FoxPro 6.0 has changed this; you can now direct the Print Preview window into an existing top-level form by including the IN WINDOW clause in the report form command. The following code demonstrates how the IN WINDOW clause can work with a top-level form:

Back to the top

Sample Code

   * Start of code example
   *
   public oMain
   oMain = CREATEOBJECT('main')  && open main form
   oMain.visible = .t.
   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

   **************************************************
   *-- Class:        main
   *-- ParentClass:  form
   *-- BaseClass:    form
   *
   DEFINE CLASS main AS form

     Top = 0
     Left = 0
     Height = 165
     Width = 220
     DoCreate = .T.
     Caption = "Main"
     Name = "main"
     opform = .F.

     ADD OBJECT command1 AS commandbutton WITH ;
       Top = 24, ;
       Left = 24, ;
       Height = 37, ;
       Width = 157, ;
       Caption = "Show Print Preview", ;
       Name = "Command1"

     ADD OBJECT command2 AS commandbutton WITH ;
       Top = 84, ;
       Left = 24, ;
       Height = 37, ;
       Width = 157, ;
       Caption = "Close", ;
       Name = "Command2"

     PROCEDURE command1.Click
       oPForm = CREATEOBJECT('printpreview')
       oPform.visible = .t.    && open printpreview form
   *******
   * This is the report form command that uses the IN WINDOW Clause.
   * Notice that it uses both WINDOW and IN WINDOW clauses. The WINDOW
   * clause tells the Print Preview window to take on the characteristics
   * of the window, while IN WINDOW tells in what window to display the
   * Print Preview window.
   *******
    REPORT FORM report_1 PREVIEW WINDOW printpreview IN WINDOW printpreview
    ENDPROC

    PROCEDURE command2.Click
      thisform.release
    ENDPROC

   ENDDEFINE
   *
   *-- EndDefine: main
   **************************************************

   DEFINE CLASS printpreview AS form

     ScaleMode = 3
       Top = 0
       Left = 0
       Height = 454
       Width = 641
       ShowWindow = 2
       DoCreate = .T.
       Caption = "Print Preview Window"
       Movable = .T.
       TitleBar = 0
       WindowState = 0
       SizeBox = .F.
       Name = "printpreview"

   ENDDEFINE

   *End of Sample code
				

Back to the top

REFERENCES

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by David Botzenhart, Microsoft Corporation

Back to the top


APPLIES TO
Microsoft Visual FoxPro 6.0 Professional Edition
Microsoft Visual FoxPro 7.0 Professional Edition
Microsoft Visual FoxPro 8.0 Professional Edition
Microsoft Visual FoxPro 9.0 Professional Edition

Back to the top

Keywords: 
kbhowto KB188887

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.