Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>managing the printer as an object</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Managing the printer as an object
--------------------------------------------------------------------------------

  FiveWin manages the printer as an object, so controlling the printing
  process is as easy as manipulating, from an object oriented point of view,
  the printer object.

  * How to create a Printer object ?

  FiveWin provides a TPrinter Class to manage the printer as an object,
  and some specific xBase commands to easier much more that manipulation:

  PRINT oPrn NAME "My Printout" PREVIEW

     PAGE
        ...
        oPrn:Say( nRow, nCol, cText, ... )
        ...
     ENDPAGE

  ENDPRINT

  The PRINT command is building there a TPrinter object. From that moment
  on we may manipulate it directly, using all the DATA and METHODs offered
  by the TPrinter Class.

  * How to manipulate the Printer Object ?

  Normally you create several pages using the commands:

  PAGE
     ...
  ENDPAGE

  And from inside that section you send messages to the Printer object.
  The most common message used is <oPrn>:Say() :

  oPrn:Say( nRow, nCol, cText, ... )

  Remember that the coordinates where you are printing depend upon the
  specific printer resolution you may be using. In order to control this,
  you have to ask the printer object about its specific resolution:

  oPrn:nVertRes() is the number of pixels in vertical
  oPrn:nHorzRes() is the number of pixels in horizontal

  Now, you divide those values by the number of rows and cols that you
  want to manage, and increase nRow, nCol according to those steps.
  See SAMPLES\TestPrn2.prg

  * How to define a font that adapts to a specific Printer Object ?

  To create a font object that adapts its size to the specific resolution
  of a printer, we use as always the container clause OF :

  local oPrn, oFont

  PRINT oPrn

     DEFINE FONT oFont NAME "Arial" SIZE 0, -10 OF oPrn

     ...

     PAGE
        ...
        oPrn:Say( nRow, nCol, cText, oFont, ... )
        ...
     ENDPAGE

  ENDPRINT

  oFont:End()

  Remember to destroy the font once you have finished printing.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson