home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / pb / library3 / viewprin.prn < prev    next >
Encoding:
Text File  |  1990-02-15  |  5.0 KB  |  200 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.                                    View Print Unit
  31.                                          for
  32.                                       PowerBASIC
  33.  
  34.  
  35.                                    by:             
  36.                                      Barry Erick
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           PowerBASIC ver 2.0 is missing the View Print command and this
  74.           Unit will allow this command to mimicked. There is only one
  75.           variable that needs to be public in your program so all you need
  76.           to do to use this unit is to add these two lines to a program:
  77.                $LINK "VP1.PBU"
  78.                PUBLIC Vpatr%
  79.  
  80.           You also need, of course, to add the calls to the procedures in
  81.           this .pbu Unit. This is different from the GWBasic View Print,
  82.           where only the top line and bottom line are specified; ViewPrint
  83.           also specifies the left and right coordinates.
  84.  
  85.  
  86.           There are 7 routines in VP1.Pbu. They are:
  87.  
  88.              1.  Function SetVpatr
  89.  
  90.              2.  Procedure GetForeAndBack
  91.  
  92.              3.  Procedure ViewPrint
  93.  
  94.              4.  Procedure ClsVpWind
  95.  
  96.              5.  Procedure Vprint
  97.  
  98.              6.  Procedure VprintCk
  99.  
  100.              7.  Procedure VpLocate
  101.  
  102.           The demo file, VPDemo1.Bas, uses each of these routines in its
  103.           demo.  The idea behind using this is to Get the vpatr (or
  104.           attribute)  you will use by using the function, SetVpatr and then
  105.           calling ViewPrint to set or clear the window. The other routines
  106.           are to be used while a view port is open. In detail:
  107.  
  108.           Function SetVpatr
  109.                          This function returns the attribute of a
  110.                          foreground and background color you send it. The
  111.                          calling sequence is:
  112.                          Vpatr% = SetVpatr%(ForeColor%,BackColor%)
  113.  
  114.                          The variable Vpatr% should be used, as this is
  115.                          passed to the other routines. This could have
  116.                          remained private to the Unit, but the ability to
  117.                          work with the attribute in use can be beneficial.
  118.  
  119.           Procedure GetForeAndBack
  120.                          This procedure does just the opposite of the
  121.                          function SetVpatr. Given the Vpatr%, this returns
  122.                          the Foreground% and Background% colors. Call
  123.                          using:
  124.                          CALL GetForeAndBack(Vpatr%,ForeColor%,BackColor%)
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                         - 2 -
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.           Procedure ViewPrint
  140.                          This procedure should be called once to open the
  141.                          view print window or port, and once again to close
  142.                          it. It is called with:
  143.                               Call ViewPrint(TopRow%,BottomRow%,_
  144.                                              LeftColumn%,RightColumn%)
  145.  
  146.           Procedure CLSVpWind
  147.                          This procedure does a clear screen within the view
  148.                          port using the Vpatr% attribute.
  149.                               Call ClsVpWind
  150.                          There are no parameters with this call.
  151.  
  152.           Procedure VPrint
  153.                          This prints a string within the view port.
  154.                          Unpredictable results if the string is longer than
  155.                          the width of the window.
  156.                               Call Vprint(a$)
  157.  
  158.           Procedure VprintCk
  159.                          This routine simply places the cursor on the next
  160.                          line, scrolling if necessary, and allows you to
  161.                          use most PB screen related commands, such as Print
  162.                          Using and Input$ within the window.
  163.                               Call VprintCk
  164.  
  165.           Procedure VpLocate
  166.                          This procedure is analogous to the Locate
  167.                          statement but is relative to the view port window
  168.                          coordinates.
  169.                               Call VpLocate(VPRow%,VpCol%)
  170.                          If the parameters are -1, then that parameter
  171.                          carries the current CsrLin or Pos. For example:
  172.                               Call VpLocate(-1,5)
  173.                          indents on the current line to the 5th position.
  174.                          By the same token,
  175.                               Call VpLocate(2,-1)
  176.                          Stays at the same x coordinate and moves to line
  177.                          2.
  178.  
  179.           The author may be contacted via Compuserve (75300,214)  or
  180.           GEnie(B.ERICK). PowerBASIC Support on GEnie is in the IBM Product
  181.           Support RT on Page 115, CATegory 5 and on CIS in the IBM Vendor
  182.           product Support Fourm, section 12. Go PCVenB at any prompt.
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.                                         - 3 -
  198.  
  199.  
  200.