DOEVENTS

Eject, Eject Page, On Page

EJECT and EJECT PAGE both send ejects to the printer, but clean up from it differently. EJECT is intended for use with @...SAY output, while EJECT PAGE is meant to work with ? and ?? streaming output. ON PAGE lets you establish an event handler for reaching the end of the page (or a specified line) in streaming output.

Usage

EJECT EJECT PAGE
EJECT sends a formfeed to the printer. But it doesn't take effect until you SET PRINT TO to finish the print job. EJECT PAGE also sends a formfeed, but it resets a bunch of the printer variables, as well. It's a better choice in a program using streaming output.

Usage

ON PAGE [ AT LINE nTriggerLine ] [ Command ]
ON PAGE is an event handler. In streamed output, when you reach the end of the page, the specified command is executed. If you include the AT clause, the command is executed when you reach that line. The ON PAGE handler lets you leave top and bottom margins and include a header or footer.

Be sure to turn off the ON PAGE handler (by issuing ON PAGE with nothing following) before you SET PRINT OFF. If you're redirecting output to a file and don't do so, you end up sending a blank page to the printer.

When you issue EJECT PAGE inside an ON PAGE handler, it uses linefeeds to complete the page regardless of the setting of _PADVANCE.

We haven't used these commands since FoxBase days and we don't expect to start doing so now. Use the Report Designer or a third-party reporting tool.

Example

SET PRINT TO test.txt SET PRINT ON _PAGENO = 1 _PLENGTH = 15 ON PAGE AT LINE 12 DO footer   FOR ncnt=1 TO 3    ?"Page "+PADL(_pageno,2)    FOR ncnt2 = 1 TO 20       _PCOLNO = 2*ncnt2       ??"Line "+PADL(ncnt2,2)       ?    ENDFOR ENDFOR ON PAGE SET PRINT OFF SET PRINT TO   PROCEDURE footer   ?"This is the end of the page" EJECT PAGE   ENDPROC

See Also

?, ??, _PageNo, _PLength


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net