Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Previewing a report
Message
From
30/11/2004 21:11:56
 
 
To
30/11/2004 17:14:44
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00965887
Message ID:
00965952
Views:
43
This message has been marked as the solution to the initial question of the thread.
Valentin -

>> When we preview a report using the new engine 9.0, it does
>> not maximized always.
>>
>> Is there are way wherein when you preview, the preview window
>> will always be maximized?

Along with Hilmar's suggestion, you could use a PreviewExtensionHandler like so:
rl = create("ReportListener")
rl.ListenerType = 1
pc = null
do (_reportpreview) with pc
pc.SetExtensionHandler( newobject("PreviewExtension") )
rl.PreviewContainer = m.pc

report form ? object m.rl

return


define class PreviewExtension as custom
	procedure Show( iModal )
		THIS.PreviewForm.WindowState = 2
		THIS.PreviewForm.Toolbar.Dock(0)
	endproc

	procedure AddBarsToMenu( cPop, iNext )
	endproc
	
	procedure HandledKeyPress( nKey, nMod )
	endproc
	
	procedure Paint()	
	endproc
	
	procedure Release()
	endproc
enddefine
By default, the preview container will remember how you left the preview window for that report and restore the settings. But this should override that.

The reason you can't get at the .WindowState property before actually running the report form is that the preview form doesn't exist yet. What you have in the m.PC variable is a reference to a proxy object, which among other things, handles figuring out what preview form class to instantiate in its .Show() method. (This wouldn't have been quite as necessary if it were possible to change properties like .Desktop, .TopForm, .WindowType, etc, on the fly.)
Alas, .SetWindowState() was not implemented in the PreviewProxy object.

Perhaps you would like to set up the VFP environment so that your handler is always used? One way is to do the following:
*------------------------------------
* A Customised ReportPreview Factory.
* _REPORTPREVIEW = <this program>
*------------------------------------
lparameter pcRef

do HOME()+"ReportPreview.App" with  pcRef
pcRef.SetExtensionHandler( newobject("PreviewExtension") )
return

define class PreviewExtension as custom
    :
I hope this helps,
- Colin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform