Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
This command pair and the whole slew of associated system variables are remnants of a printer control system that first appeared in FoxPro 1. In that DOS-dominated, application-centric, dot-matrix, tractor-feed world, it was a clever way to avoid providing printer drivers but still give you control over output.
In a Windows world, most of this is totally irrelevant. Only one of these variables still does anything, and it doesn’t do it very well. The table shows what these variables were originally intended to do. Except for _PCOPIES, they’re all ignored in Visual FoxPro.
Variable |
Type |
Meaning |
_PBPage |
Numeric |
The number of the first page to be printed. |
_PCopies |
Numeric |
The number of copies to print. |
_PECode |
Character |
Printer control codes to send after printing. |
_PEject |
Character |
Determined whether ejects were sent before the report, after the report, both or neither. |
_PEPage |
Numeric |
The number of the last page to be printed. |
_PSCode |
Character |
Printer control codes to send before printing. |
_PWait |
Logical |
Determined whether to wait for paper to be loaded before printing each page. |
PRINTJOB … ENDPRINTJOB is a wrapper that says everything inside is to be treated as one group. If _PCOPIES is greater than 1, PRINTJOB … ENDPRINTJOB creates a de facto loop.
Although _PCOPIES works, it’s no better than simply wrapping your call to REPORT FORM in a FOR loop. It still generates the report multiple times and sends each to the printer independently.
We suggest you forget these are even in the language. Saying this makes us very unhappy, since _PBPage and _PEPage used to let us print only part of a report, but they don’t do it in VFP. Starting in VFP 5, the RANGE clause of REPORT FORM is the solution to that one.
PRINTJOB
_PCOPIES = 3
REPORT FORM MyReport TO PRINT
ENDPRINTJOB