Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preview if SCREEN OFF
Message
From
14/04/2014 13:29:37
 
 
To
14/04/2014 02:02:04
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01598514
Message ID:
01598615
Views:
97
>One trick I've used is to use the current top-level form. The idea is to hide all current controls, make the form full-screen, run the report, put the form back to original size and show its controls.
>
>WITH ThisForm
>	.LockScreen = .T.
>	.Closable = .F.
>	.SetAll( "Visible", .F. )
>	.WindowState = 2
>	.LockScreen = .F.
>
>ENDWITH
>
>* Experiment with the following KEYBOARD commands to force full-screen report preview (may need 1, 2, or ?)
>KEYBOARD "{CTRL+F10}"
>KEYBOARD "{CTRL+F10}"
>REPORT FORM ( tcReport ) TO PRINTER PROMPT PREVIEW
>
>WITH ThisForm
>	.LockScreen = .T.
>	.Closable = .T.
>	.SetAll( "Visible", .T. )
>	.WindowState = 0
>	.LockScreen = .F.
>
>ENDWITH
>
>I don't know if this gives you the toolbar you want. It's tricky to get it to work just the way you want, I won't be providing any further support for this code.

To expand on Al's example, perhaps you can utilize the additional "IN WINDOW" clause that can be used with PREVIEW? (see on-line help on the REPORT command) Basically you can create a form object (with appropriate settings) to act as a "template" for the actual preview window (i.e. the preview window "inherits" the characteristics of the "template"). As Al had stated, the next problem would be the report toolbar (which generally only appears on the main VFP window).

Basically something along the following:
* NOTE: Using FORM class here directly for sake of illustrating a coding technique, in reality you should
*       use a subclass of FORM (i.e. whatever "master" class you're using for all your forms).   Otherwise
*       there is no other way to set various properties like ShowWindow
oPreviewWin = CREATEOBJECT("FORM")
WITH oPreviewWin
    .NAME = "WPREVIEW"
    .CAPTION = "Report Preview"
    .WIDTH = 800
    .HEIGHT = 600
    .TOP  = (SYSMETRIC(1) - .WIDTH) / 2
    .LEFT = (SYSMETRIC(2) - .HEIGHT) / 2
    .MOVABLE = .T.
    .CLOSABLE = .T.
    .MDIFORM = .T.
    .MINBUTTON = .T.
    .MAXBUTTON = .T.
    .ZOOMBOX = .T.
    .HALFHEIGHTCAPTION = .F.
ENDWITH

* NOTE: The code for saving current directory and restoring it has been added to work around possible problem
*        which could arise if the current directory changes unexpectedly -- which could happen if a "save to file" dialog
*        is used -- even if you don't explicitly code such a thing (e.g. If user selects printer associated with a PDF printer,
*        from which a "save as" dialog would often appear).
lcCurDir = SYS(5)+SYS(2003)   && Save current directory
KEYBOARD "{CTRL+F10}"         && maximize preview window
REPORT FORM (m.cReptForm) ;
    PREVIEW WINDOW wPreview TO PRINT PROMPT
SET DEFAULT TO (m.lcCurDir)   && Restore current directory
RELEASE oPreviewWin
Previous
Reply
Map
View

Click here to load this message in the networking platform