You can use an extension handler to manipulate the preview container on VFP
9 reports. An extension handler is nothing more than a class, based on the
VFP base custom class, which has a few specific methods. See "Leveraging the
Default Preview Container" in the VFP 9 help file for more information on
what methods need to exist. In your extension handler class, add the
following line to the Show method.

This.PreviewForm.AllowPrintFromPreview = .f.


Now use the following code to instantiate your extension handler and hook it
up to the preview container which is then hooked up to the report listener. 

*-- Using an extension handler
LOCAL   loPreviewContainer, ;
                loReportListener, ;
                loExtensionHandler

SET CLASSLIB TO <<Your Class library>>

*-- Create the preview container
DO (_REPORTPREVIEW) WITH loPreviewContainer

*-- Invoke the Extension Handler
loExtensionHandler = CREATEOBJECT('YourExtensionHandler')

*-- Hook the Extension Handler to the preview container
m.loPreviewContainer.SetExtensionHandler(m.loExtensionHandler)

*-- Create the Report Listener for the preview
DO (_ReportOutput) WITH 1, loReportListener 

*-- Assign the preview container to the listener
m.loReportListener.PreviewContainer = m.loPreviewContainer

*-- Run the report
REPORT FORM Whatever OBJECT m.loReportListener PREVIEW


Cathy Pountney

> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
On
> Behalf Of James E Harvey
> Sent: Tuesday, September 22, 2009 11:34 AM
> To: [email protected]
> Subject: RE: No print report option
> 
> So what I'm trying to accomplish is to suppress the printer button on the
> toolbar?
> 
> James E Harvey
> Hanover Shoe Farms, Inc.
> M.I.S./Corresponding Officer
> Off: 717-637-8931
> fax: 717-637-6766
> email: [email protected]
> 
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of James E Harvey
> Sent: Tuesday, September 22, 2009 11:15 AM
> To: 'ProFox Email List'
> Subject: No print report option
> 
> I'm using VFP9 sp2 with hotfix.
> 
> How can I allow a user to preview a report, but not print?
> 
> This is what I usually use, "Report form sales to print prompt preview"
> 
> The reason for NOT allowing the printing is because the report is over
> 1,000
> pages long, and we don't want people wasting paper.  It will be previewed
> on
> a 42 inch flat screen tv.
> 
> James E Harvey
> Hanover Shoe Farms, Inc.
> M.I.S./Corresponding Officer
> Off: 717-637-8931
> fax: 717-637-6766
> email: [email protected]
> 
> 
> 
> 
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/004901ca3bad$1706e7f0$4514b7...@com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to