





                                                September 29, 1987



                                   TBWINDO
                             MULTI-LEVEL WINDOWS
                           FOR BORLANDS TURBO BASIC
                                 Version 3.2
          PURPOSE:

          This utility creates  incredibly quick multi-level windows
          in Turbo Basic programs for IBM PC/XT/AT compatibles.


          TEST DRIVE:

          Compile and run the tutoring program TBDEMO32.BAS to get a
          feel for features and speed.


          FILES:

          In this version, TBWINDO.ARC contains:
               TBWINDO.INC    - Turbo Basic window include file
               TBMENU.INC     - Menu include file
               TBINPUT.INC    - Structured input include file
               QPRINT.BIN     - Quick print inline subroutine
               QPRINTC.BIN    - Quick print between columns
               QATTR.BIN      - Re-attribute an area of the screen
               QFILL.BIN      - Fill an area of the screen with a
                                specified character and attribute
               QSAVE.BIN      - Save portion of screen
               QREST.BIN      - Restore portion of screen
               RECOLOR.BIN    - Screen area recoloring
               TBDEMO32.BAS   - Demonstration program source code
               TBWIND32.DOC   - This document file.
               README.1ST     - Most recent changes and corrections.

          Assembly  language  source  code  for  all  BIN  files  is
          included for  all those  interested.  Any  Suggestions for
          improvements to the code would be appreciated, as I do not
          profess to be good at Assembly language.

          USING TBWINDO

          Include the TBWINDO.INC  program in your  program with the
          following statement:


                  $INCLUDE "TBWINDO.INC"

          Set MW%  variable equal to  the maximum  number of windows
          you will have open at any one time.



                                    - 1 -









          Set the  ScrnArray variable  equal to  the estimated total
          memory required to save your screens.  If you expreience a
          subscript out of range error in the include file, increase
          this variable.  As  a rough rule of  thumb, start out with
          the variable equal to 250  times the maximum windows (mw%)
          variable.
          

          You invoke the routines by means  of a CALL with a list of
          parameters, rather than a GOSUB.


          Using the MAKEWINDOW procedure:

          CALL
          MAKEWINDOW(ROW%,COL%,ROWS%,COLS%,ATTR%,BRDRSEL%,SHADOW%,ZO
          OM%)

          Where: ROW - the screen row of the upper left hand corner
                       of your desired window.  Value should be
                       between 2 and 23 (for reasons explained
                       below).  WARNING - the subroutine does not
                       check for proper values. You must check these
                       yourself or accept the consequences.

                COL -  the screen column of the upper left hand
                       corner.  Value should be between 2 and 79.

               ROWS - the number of rows long the window should be.

               COLS - the number of columns wide the window should
                      be.

               ATTR - the attribute of the window colors.

            BRDRSEL - the border you desire  around the window.
                      Valid selections in this release are:

                      0 - No Frame (just a border of BACKground
                          color.)
                      1 - Single Line Frame
                      2 - Double Line Frame
                      3 - Single Horizontal Line, Double Vertical
                          Line
                      4 - Single Vertical Line, Double Horizontal
                          Line

             SHADOW - Another "switch" to indicate  if the window
                      should have a black "shadow" under it offset
                      down.  This gives a three-dimensional effect
                      that seems to "raise" the window away from the
                      screen.  A value of 1 indicates a shadow is
                      desired on the left side, a value of 2
                      indicates the right side, while a value of 0


                                    - 2 -









                      means no shadow.

               ZOOM - A "switch" used to indicate to the subroutine
                      if the window should "grow" from a small box
                      at the midpoints of the coordinates to full
                      size. A value of 1 indicates the window should
                      grow. A value of 0 indicates it should not.
          


          using the TITLEWINDOW procedure:

          CALL TITLEWINDOW(LOC%,TITLE$)

          Where: LOC - Indicates where the title should be placed.
                       Valid selections are:

                       1 - Top left hand corner
                       2 - Top center
                       3 - Top right hand corner
                       4 - Lower left hand corner
                       5 - Lower center
                       6 - Lower right hand corner

               TITLE - The string data you would like printed.

          NOTE:  The TITLEWINDOW procedure uses the coordinates from
                 the most recent use of MAKEWINDOW.  Use this
                 procedure only after a call has been made to
                 MAKEWINDOW.


          Using the RemoveWindow procedure:

          CALL REMOVEWINDOW

          There  are no  parameters passed  to this  procedure.  The
          window created by  the last call  to MakeWindow is removed
          from the screen.

          Using the ClearWindow procedure:

          CALL CLEARWINDOW

          There  are  no  parameters pass  to  this  procedure.  The
          window created by  the last call  to MakeWindow is cleared
          inside the frame.

          Using the PrtWindow procedure:

          CALL PRTWINDOW(ROW%,COL%,STRDAT%)

          Where:  ROW - Is the row within the window you want to
                        print on.


                                    - 3 -










                  COL - Is the column within the  window where you
                        want printing to start.

          NOTE:  The ROW and COL  coordinates are relative to the
                 current window.  Row 1 Col 1 refers to the first
                 character position inside the frame in the upper
                 left corner.  No parameter checking is done so if
                 the string data exceeds the  width of the window it
                 will spill out the right side.
          
               STRDAT - Is the string  data you want printed inside
                        the window.


          Using the PrtCWindow procedure:

          CALL PRTCWINDOW(ROW%,STRDAT$)

          Where:  ROW - Is  the row  within  the  window you want to
                        have your string data centered on.

          NOTE:  This procedure uses the current window and will
                 attempt to center the string data between the left
                 border and the right border.  No parameter checking
                 is done so if the string data exceeds the width of
                 the window, it will spill out the sides.

               STRDAT - Is the string data  you want printed within
                        the window.

          Using the FNATTR% function:

          FNATTR%(FORE%,BACK%)

          Where: FORE - is the foreground color.  Any Turbo Basic
                        color number is valid.

                 BACK - is the backgound color.  Any Turbo Basic
                        background color is valid.

          FNATTR% returns the attribute of the colors specified.


          Using the RECOLOR procedure:

          CALL RECOLOR(OLDATTR%,NEWATTR%,SNOCHK%)

          Where: OLDATTR - Is the attribute of the areas on the
                           screen you wish to change.

                 NEWATTR - Is the attribute of the color you want.




                                    - 4 -









                 X% = SCREEN(1,1,1)  ' RETURNS CURRENT SCREEN
                                     ' ATTRIBUTE
                 CALL RECOLOR(X%,FNATTR%(14,4))

                 This will recolor everything on the screen that
                 has the same attribute a the upper left corner of
                 the screen to a foreground of 14 and a background
                 of 4.

          Using the WINDOWXY procedure:

          CALL WINDOWXY(ROW%,COL%)

          Where:  ROW = The row within the window.
          
                  COL = The column within the window.

          This procedure is similar to Basic's LOCATE command except
          the ROW and  COL  coordinates are  relative to the current
          window.   Row  1  Col  1  refers  to  the  first character
          position inside  the frame in  the upper  left corner.  No
          parameter checking  is done  so it  is possible  to locate
          outside the window.


          Using the MAKEMENU procedure:

          Define and title your menu with calls to MakeWindow and
          TitleWindow.  Then define the  selections available to the
          user in  a string array  named item$().   Assign the total
          selections  available  to   itemcount%  and  the  starting
          selection number to startpos%.  Now CALL MAKEMENU.

          When a selection has be made in the MakeMenu procedure the
          item  number selected  will  be assigned  to  the variable
          curntpos%.  You can now use this number to direct the flow
          of you  main program.  Please  see the source  code of the
          demo  program for  a better  understanding.  One  point to
          remember is  that a MENU  window is no  different than any
          other window.  You  can pop one over  the other and remove
          them as would a normal window.

          All  of  the above  variables  with the  exception  of the
          string variables  must either  be   declared  globally  as
          integers by  means of  a DEFINT  statement early   in  the
          program;  or  must  have  the  specific integer identifier
          (%)  attached  wherever  they   appear in the program. The
          BASIC  compiler  is picky  about  this; so   be   sure  to
          verify that the type assignment is correct.

          TBWINDO  requires no  special  handling when  it  comes to
          compiling your program. Just make certain that all of
          your variables passing parameters to the TBWINDO
          subroutine  are identified  as integers,  and you  will be


                                    - 5 -









          able to  proceed with  the compile  operation as  with any
          other program.


          ACKNOWLEDGEMENTS

          I  would  like   to  express  my   thanks  to  Dave  Evers
          (BASWIN22),   Tom   Hanlin   (ADVBAS33)   and   Jim  LeMay
          (WINDOW33).   The routines  presented are  patterned after
          routines  that were  written by  them for  MicroSoft Quick
          Basic and Borland Turbo Pascal.

          These utilities  are released  into the  public domain for
          anyone to  use as they  see fit however,  anyone who feels
          inspired and would like to  contribute to my printer paper
          and computer supplies fund may feel free to do so.

          Rick Fothergill
          141 Oak Hill Road
          Pittsfield, MA 01201
          (413) 442-2456

          GEnie Address: R.FOTHERGILL
             Compuserve: 76210,443
                    BBS: (413) 499-7245  300-1200-2400 Baud N-8-1
                         8:00am - 4:00pm Monday through Friday






























                                    - 6 -











                           TBWINDO QUICK REFERENCE


          
          MakeWindow(Row%,Col%,Rows%,Cols%,Attr%,BrdrSel%,Shadow%,Zo
          om%)

                           TitleWindow(Loc%,Title$)

                                 RemoveWindow

                                 ClearWindow

                                   MakeMenu

                         PrtWindow(Row%,Col%,StrDat$)

                           PrtCWindow(Row%,StrDat$)

                             FNAttr%(Fore%,Back%)

                             WindowXY(Row%,Col%)

                    Qsave(Row%,Col%,Rows%,Cols%,Scrn%(??))

                    QRest(Row%,Col%,Rows%,Cols%,Scrn%(??))

                      ReColor(OldAttr%,NewAttr%,SnoChk%)

                       Qprint(Row%,Col%,StrDat$,Attr%)

                QprintC(Row%,ColLeft%,ColRight%,StrDat$,Attr%)

                   QFill(Row%,Col%,Rows%,Cols%,Char%,Attr%)

                      QAttr(Row%,Col%,Rows%,Cols%,Attr%)

                  QBox(Row%,Col%,Rows%,Cols%,Attr%,BrdrSel%)
















                                    - 7 -



