Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Report Designer cr7 - trying to use index table
Message
From
03/02/2000 12:52:13
Walter Meester
HoogkarspelNetherlands
 
 
To
03/02/2000 11:29:50
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00325913
Message ID:
00326775
Views:
36
Ken,

>I am trying to control the crystal report preview window location and size
>with no luck. also the preview appears for a a half second then disappears.
>could you tell me what I am doing wrong.
>
>DECLARE INTEGER GetActiveWindow IN Win32API
>LOCAL lnhwnd
>lnhwnd = GetActiveWindow()
>tcrptname="C:\Seagate Software\Crystal Reports\womasbydept.rpt"
>reportapp=createobject("Crystal.CRPE.Application")
>orpt = reportapp.OpenReport(tcRPTName)
>orpt.PrintWindowOptions.HasPrintSetupButton =.t.
>orpt.PrintWindowOptions.HasSearchButton =.t.
>orpt.PrintWindowOptions.HasexportButton =.t.
>orpt.PrintWindowOptions.HascancelButton =.t.
>orpt.PrintWindowOptions.hasZoomControl=.t.
>orpt.Preview("Title", 12, 23, 624, 643,2,lnhwnd)
>*orpt.Preview

The variable orpt goes out of scope and thereby releasing the report. The best way to solve this problem is to assign the preview to a form property.

The best way to control the Preview i've found is to use the FoxHwnd activeX control. This control (in the example named FOXHNWD) provides a HWND in which the preview can be displayed.
DECLARE INTEGER GetWindow IN user32.DLL INTEGER, INTEGER
DECLARE SetWindowPos IN win32api INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER

* Initialize the size of the FoxPro preview window

THISFORM.TOP=5
THISFORM.LEFT=5
THISFORM.WIDTH=_SCREEN.WIDTH-15
THISFORM.HEIGHT=_SCREEN.HEIGHT-35

* display the preview window

THISFORM.PREVIEW=THISFORM.crEngine.Report.PREVIEW("", 0, 0, THISFORM.Width, THISFORM.Height, 33554432, THISFORM.FoxHwnd.hwnd)
THISFORM.Resize
In the resize event of the form put:
* Resize FoxHWND control and the previewwindow hosted by the FoxHWND control 

THISFORM.wind.Move(0, -2, THISFORM.Width, THISFORM.Height+2)
=SetWindowPos(GetWindow(THISFORM.FoxHwnd.hwnd, 5), 0, -2, 0, THISFORM.Width+1, THISFORM.HEight+3, 2)
HTH

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform