home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / tb / tbwindow / tbwind32.txt < prev    next >
Text File  |  1987-09-29  |  14KB  |  463 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                                 September 29, 1987
  8.  
  9.  
  10.  
  11.                                    TBWINDO
  12.                              MULTI-LEVEL WINDOWS
  13.                            FOR BORLANDS TURBO BASIC
  14.                                  Version 3.2
  15.           PURPOSE:
  16.  
  17.           This utility creates  incredibly quick multi-level windows
  18.           in Turbo Basic programs for IBM PC/XT/AT compatibles.
  19.  
  20.  
  21.           TEST DRIVE:
  22.  
  23.           Compile and run the tutoring program TBDEMO32.BAS to get a
  24.           feel for features and speed.
  25.  
  26.  
  27.           FILES:
  28.  
  29.           In this version, TBWINDO.ARC contains:
  30.                TBWINDO.INC    - Turbo Basic window include file
  31.                TBMENU.INC     - Menu include file
  32.                TBINPUT.INC    - Structured input include file
  33.                QPRINT.BIN     - Quick print inline subroutine
  34.                QPRINTC.BIN    - Quick print between columns
  35.                QATTR.BIN      - Re-attribute an area of the screen
  36.                QFILL.BIN      - Fill an area of the screen with a
  37.                                 specified character and attribute
  38.                QSAVE.BIN      - Save portion of screen
  39.                QREST.BIN      - Restore portion of screen
  40.                RECOLOR.BIN    - Screen area recoloring
  41.                TBDEMO32.BAS   - Demonstration program source code
  42.                TBWIND32.DOC   - This document file.
  43.                README.1ST     - Most recent changes and corrections.
  44.  
  45.           Assembly  language  source  code  for  all  BIN  files  is
  46.           included for  all those  interested.  Any  Suggestions for
  47.           improvements to the code would be appreciated, as I do not
  48.           profess to be good at Assembly language.
  49.  
  50.           USING TBWINDO
  51.  
  52.           Include the TBWINDO.INC  program in your  program with the
  53.           following statement:
  54.  
  55.  
  56.                   $INCLUDE "TBWINDO.INC"
  57.  
  58.           Set MW%  variable equal to  the maximum  number of windows
  59.           you will have open at any one time.
  60.  
  61.  
  62.  
  63.                                     - 1 -
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           Set the  ScrnArray variable  equal to  the estimated total
  74.           memory required to save your screens.  If you expreience a
  75.           subscript out of range error in the include file, increase
  76.           this variable.  As  a rough rule of  thumb, start out with
  77.           the variable equal to 250  times the maximum windows (mw%)
  78.           variable.
  79.           
  80.  
  81.           You invoke the routines by means  of a CALL with a list of
  82.           parameters, rather than a GOSUB.
  83.  
  84.  
  85.           Using the MAKEWINDOW procedure:
  86.  
  87.           CALL
  88.           MAKEWINDOW(ROW%,COL%,ROWS%,COLS%,ATTR%,BRDRSEL%,SHADOW%,ZO
  89.           OM%)
  90.  
  91.           Where: ROW - the screen row of the upper left hand corner
  92.                        of your desired window.  Value should be
  93.                        between 2 and 23 (for reasons explained
  94.                        below).  WARNING - the subroutine does not
  95.                        check for proper values. You must check these
  96.                        yourself or accept the consequences.
  97.  
  98.                 COL -  the screen column of the upper left hand
  99.                        corner.  Value should be between 2 and 79.
  100.  
  101.                ROWS - the number of rows long the window should be.
  102.  
  103.                COLS - the number of columns wide the window should
  104.                       be.
  105.  
  106.                ATTR - the attribute of the window colors.
  107.  
  108.             BRDRSEL - the border you desire  around the window.
  109.                       Valid selections in this release are:
  110.  
  111.                       0 - No Frame (just a border of BACKground
  112.                           color.)
  113.                       1 - Single Line Frame
  114.                       2 - Double Line Frame
  115.                       3 - Single Horizontal Line, Double Vertical
  116.                           Line
  117.                       4 - Single Vertical Line, Double Horizontal
  118.                           Line
  119.  
  120.              SHADOW - Another "switch" to indicate  if the window
  121.                       should have a black "shadow" under it offset
  122.                       down.  This gives a three-dimensional effect
  123.                       that seems to "raise" the window away from the
  124.                       screen.  A value of 1 indicates a shadow is
  125.                       desired on the left side, a value of 2
  126.                       indicates the right side, while a value of 0
  127.  
  128.  
  129.                                     - 2 -
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                       means no shadow.
  140.  
  141.                ZOOM - A "switch" used to indicate to the subroutine
  142.                       if the window should "grow" from a small box
  143.                       at the midpoints of the coordinates to full
  144.                       size. A value of 1 indicates the window should
  145.                       grow. A value of 0 indicates it should not.
  146.           
  147.  
  148.  
  149.           using the TITLEWINDOW procedure:
  150.  
  151.           CALL TITLEWINDOW(LOC%,TITLE$)
  152.  
  153.           Where: LOC - Indicates where the title should be placed.
  154.                        Valid selections are:
  155.  
  156.                        1 - Top left hand corner
  157.                        2 - Top center
  158.                        3 - Top right hand corner
  159.                        4 - Lower left hand corner
  160.                        5 - Lower center
  161.                        6 - Lower right hand corner
  162.  
  163.                TITLE - The string data you would like printed.
  164.  
  165.           NOTE:  The TITLEWINDOW procedure uses the coordinates from
  166.                  the most recent use of MAKEWINDOW.  Use this
  167.                  procedure only after a call has been made to
  168.                  MAKEWINDOW.
  169.  
  170.  
  171.           Using the RemoveWindow procedure:
  172.  
  173.           CALL REMOVEWINDOW
  174.  
  175.           There  are no  parameters passed  to this  procedure.  The
  176.           window created by  the last call  to MakeWindow is removed
  177.           from the screen.
  178.  
  179.           Using the ClearWindow procedure:
  180.  
  181.           CALL CLEARWINDOW
  182.  
  183.           There  are  no  parameters pass  to  this  procedure.  The
  184.           window created by  the last call  to MakeWindow is cleared
  185.           inside the frame.
  186.  
  187.           Using the PrtWindow procedure:
  188.  
  189.           CALL PRTWINDOW(ROW%,COL%,STRDAT%)
  190.  
  191.           Where:  ROW - Is the row within the window you want to
  192.                         print on.
  193.  
  194.  
  195.                                     - 3 -
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.                   COL - Is the column within the  window where you
  207.                         want printing to start.
  208.  
  209.           NOTE:  The ROW and COL  coordinates are relative to the
  210.                  current window.  Row 1 Col 1 refers to the first
  211.                  character position inside the frame in the upper
  212.                  left corner.  No parameter checking is done so if
  213.                  the string data exceeds the  width of the window it
  214.                  will spill out the right side.
  215.           
  216.                STRDAT - Is the string  data you want printed inside
  217.                         the window.
  218.  
  219.  
  220.           Using the PrtCWindow procedure:
  221.  
  222.           CALL PRTCWINDOW(ROW%,STRDAT$)
  223.  
  224.           Where:  ROW - Is  the row  within  the  window you want to
  225.                         have your string data centered on.
  226.  
  227.           NOTE:  This procedure uses the current window and will
  228.                  attempt to center the string data between the left
  229.                  border and the right border.  No parameter checking
  230.                  is done so if the string data exceeds the width of
  231.                  the window, it will spill out the sides.
  232.  
  233.                STRDAT - Is the string data  you want printed within
  234.                         the window.
  235.  
  236.           Using the FNATTR% function:
  237.  
  238.           FNATTR%(FORE%,BACK%)
  239.  
  240.           Where: FORE - is the foreground color.  Any Turbo Basic
  241.                         color number is valid.
  242.  
  243.                  BACK - is the backgound color.  Any Turbo Basic
  244.                         background color is valid.
  245.  
  246.           FNATTR% returns the attribute of the colors specified.
  247.  
  248.  
  249.           Using the RECOLOR procedure:
  250.  
  251.           CALL RECOLOR(OLDATTR%,NEWATTR%,SNOCHK%)
  252.  
  253.           Where: OLDATTR - Is the attribute of the areas on the
  254.                            screen you wish to change.
  255.  
  256.                  NEWATTR - Is the attribute of the color you want.
  257.  
  258.  
  259.  
  260.  
  261.                                     - 4 -
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                  X% = SCREEN(1,1,1)  ' RETURNS CURRENT SCREEN
  272.                                      ' ATTRIBUTE
  273.                  CALL RECOLOR(X%,FNATTR%(14,4))
  274.  
  275.                  This will recolor everything on the screen that
  276.                  has the same attribute a the upper left corner of
  277.                  the screen to a foreground of 14 and a background
  278.                  of 4.
  279.  
  280.           Using the WINDOWXY procedure:
  281.  
  282.           CALL WINDOWXY(ROW%,COL%)
  283.  
  284.           Where:  ROW = The row within the window.
  285.           
  286.                   COL = The column within the window.
  287.  
  288.           This procedure is similar to Basic's LOCATE command except
  289.           the ROW and  COL  coordinates are  relative to the current
  290.           window.   Row  1  Col  1  refers  to  the  first character
  291.           position inside  the frame in  the upper  left corner.  No
  292.           parameter checking  is done  so it  is possible  to locate
  293.           outside the window.
  294.  
  295.  
  296.           Using the MAKEMENU procedure:
  297.  
  298.           Define and title your menu with calls to MakeWindow and
  299.           TitleWindow.  Then define the  selections available to the
  300.           user in  a string array  named item$().   Assign the total
  301.           selections  available  to   itemcount%  and  the  starting
  302.           selection number to startpos%.  Now CALL MAKEMENU.
  303.  
  304.           When a selection has be made in the MakeMenu procedure the
  305.           item  number selected  will  be assigned  to  the variable
  306.           curntpos%.  You can now use this number to direct the flow
  307.           of you  main program.  Please  see the source  code of the
  308.           demo  program for  a better  understanding.  One  point to
  309.           remember is  that a MENU  window is no  different than any
  310.           other window.  You  can pop one over  the other and remove
  311.           them as would a normal window.
  312.  
  313.           All  of  the above  variables  with the  exception  of the
  314.           string variables  must either  be   declared  globally  as
  315.           integers by  means of  a DEFINT  statement early   in  the
  316.           program;  or  must  have  the  specific integer identifier
  317.           (%)  attached  wherever  they   appear in the program. The
  318.           BASIC  compiler  is picky  about  this; so   be   sure  to
  319.           verify that the type assignment is correct.
  320.  
  321.           TBWINDO  requires no  special  handling when  it  comes to
  322.           compiling your program. Just make certain that all of
  323.           your variables passing parameters to the TBWINDO
  324.           subroutine  are identified  as integers,  and you  will be
  325.  
  326.  
  327.                                     - 5 -
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.           able to  proceed with  the compile  operation as  with any
  338.           other program.
  339.  
  340.  
  341.           ACKNOWLEDGEMENTS
  342.  
  343.           I  would  like   to  express  my   thanks  to  Dave  Evers
  344.           (BASWIN22),   Tom   Hanlin   (ADVBAS33)   and   Jim  LeMay
  345.           (WINDOW33).   The routines  presented are  patterned after
  346.           routines  that were  written by  them for  MicroSoft Quick
  347.           Basic and Borland Turbo Pascal.
  348.  
  349.           These utilities  are released  into the  public domain for
  350.           anyone to  use as they  see fit however,  anyone who feels
  351.           inspired and would like to  contribute to my printer paper
  352.           and computer supplies fund may feel free to do so.
  353.  
  354.           Rick Fothergill
  355.           141 Oak Hill Road
  356.           Pittsfield, MA 01201
  357.           (413) 442-2456
  358.  
  359.           GEnie Address: R.FOTHERGILL
  360.              Compuserve: 76210,443
  361.                     BBS: (413) 499-7245  300-1200-2400 Baud N-8-1
  362.                          8:00am - 4:00pm Monday through Friday
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                     - 6 -
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.                            TBWINDO QUICK REFERENCE
  406.  
  407.  
  408.           
  409.           MakeWindow(Row%,Col%,Rows%,Cols%,Attr%,BrdrSel%,Shadow%,Zo
  410.           om%)
  411.  
  412.                            TitleWindow(Loc%,Title$)
  413.  
  414.                                  RemoveWindow
  415.  
  416.                                  ClearWindow
  417.  
  418.                                    MakeMenu
  419.  
  420.                          PrtWindow(Row%,Col%,StrDat$)
  421.  
  422.                            PrtCWindow(Row%,StrDat$)
  423.  
  424.                              FNAttr%(Fore%,Back%)
  425.  
  426.                              WindowXY(Row%,Col%)
  427.  
  428.                     Qsave(Row%,Col%,Rows%,Cols%,Scrn%(??))
  429.  
  430.                     QRest(Row%,Col%,Rows%,Cols%,Scrn%(??))
  431.  
  432.                       ReColor(OldAttr%,NewAttr%,SnoChk%)
  433.  
  434.                        Qprint(Row%,Col%,StrDat$,Attr%)
  435.  
  436.                 QprintC(Row%,ColLeft%,ColRight%,StrDat$,Attr%)
  437.  
  438.                    QFill(Row%,Col%,Rows%,Cols%,Char%,Attr%)
  439.  
  440.                       QAttr(Row%,Col%,Rows%,Cols%,Attr%)
  441.  
  442.                   QBox(Row%,Col%,Rows%,Cols%,Attr%,BrdrSel%)
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                     - 7 -
  460.  
  461.  
  462.  
  463.