When we allow the users to preview a report in our application, the default print preview toolbar appears in the screen. That toolbar has the printer icon using which the user can print the report. What if we want to stop this printing ? We have to remove the printer button from the print preview toolbar. But again we also want to provide this facility in yet another report or to another user of the same report. So the way we can conditionaly remove this print preview button is provided below.
Reach the VFPs menubar -> Select View -> ToolBar SELECT Only Print Preview with (x) AND click ON Customise button. The PrintPreview Toolbar is shown on the VFP _screen.
Now on the print preview toolbar which is appearing on the screen (out side of Customize Toolbar window), CLICK and select the Printer Button and drag it out of the toolbar. Now you can see the printer button gone from the toolbar. CLOSE the Customise ToolBar Window.
Now from the command window type
SELECT * FROM (SYS(2005)) INTO DBF myFoxUser ;
WHERE UPPER(Name) == 'PRINT PREVIEW' AND ! DELETED()
USE
The print previw toolbar without the print button is saved in the resource file myFoxUser. You have to distribute this table along with your application data.(Both .dbf and .fpt)
Now using this resource file, we can avoid the PrintPreview button from showing on the toolbar. You can even use a conditional variable lAllowPrinting and code suitably as given below.
** Allow PrintinglAllowPrinting = .t. ** Deny PrintinglAllowPrinting = .f. IF ! lAllowPrinting SET RESOURCE TO myFoxUserENDIF REPORT FORM myreport PREVIEW IN SCREENSET RESOURCE TO
** EOF