April 28, 1988 TBWINDO MULTI-LEVEL WINDOWS FOR BORLANDS TURBO BASIC Version 6.0 FILES In this version, TBW60.ARC contains TBW60.INC - Turbo Basic window include file TBW60.DEF - Definition file for including TBD60.BAS - Demonstration program source code TBW60.TXT - This document file. USING TBWINDO Include the TBW60.DEF program in your program with the following statement: $INCLUDE "TBW60.DEF" Set MW% variable equal to the maximum number of windows you will have open at any one time. Set the ScrnArray variable equal to the estimated total memory required to save your screens. If you experience 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. 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. Make certain that all of your variables passing parameters to the TBWINDO subroutine are identified as integers, and you will be able to proceed with the compile operation as with any other program. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 1 - If you are using TBWINDOs and find it of value a contribution ($20.00) to the author is suggested. This will enable and encourage the further development of TBWINDOs. WARRANTY AND DISCLAIMER The author make no warranties, expressed or implied, as to the quality or performance of this program. The author will not be held liable for any direct, indirect, incidental or consequential damages resulting from the use of this program. Your use of the program constitutes your agreement to this disclaimer and your release of the author from any form of liability or litigation. Rick Fothergill BBS - (413) 499-7245 141 Oak Hill Road 300-1200-2400 baud 8-N-1 Pittsfield, MA 01201 8am - 4pm Eastern TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 2 - DEFINITIONS OF COMMON VARIABLES USED IN THE STATEMENT AND FUNCTION DESCRIPTIONS: ATTR - integer value for the foreground and background color. See FNATTR. BACK - integer value representing any one of BASIC's background colors. Valid numbers are 0 - 8. BATTR - integer value representing the border color attribute. BARTYPE - type of highlight bar selected, used by MAKEMENU 0 - no visible bar 1 - full width bar 2 - string width bar 3 - pointer BORDER - integer value representing the desired border type. Valid selections are: 1 - single line 2 - double line 3 - single horizontal, double vertical 4 - double horizontal, single vertical 5 - solid 6 - light hatch 7 - medium hatch 8 - heavy hatch COL - integer value representing the screen column, should be in the range of 2 - 79 COLS - integer value representing the number of columns wide. CURNTPOS - position of menu selection bar returned by MAKEMENU FLATTR - color attribute of the first letter of each item in a menu, used by MAKEMENU FLON - a switch used by MAKEMENU to indicate whether first letter selection is active. 0 - first letter not active -1 - first letter active FORE - integer value representing any one of BASIC's foreground colors. Valid numbers are 0 - 31. HLATTR - color attribute of menu highlight bar, used by MAKEMENU TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 3 - ITEM$() - a string array of menu selections used by MAKEMENU ITEMCOUNT - total number of items in current menu MAXITEM - maximum item allowed in a menu, used by MAKEMENU MW - maximum windows and menus allowed to be open at once ROW - integer value representing the screen row, should be in the range of 2 - 23. ROWS - integer value representing the number of rows long. SATTR - integer value representing then shadow color attribute SHADOW - integer value representing the desired shadow type. Valid selections are: 0 - No shadow 1,2 - Reattribute shadow, does not destroy 3,4 - Solid Block 5,6 - Light Hatch 7,8 - Medium Hatch 9,10 - Heavy Hatch Odd - Left Even - Right STARTPOS - starting position for the menu selection bar, used by MAKEMENU STRDAT$ - string data. WATTR - integer value representing the window color attribute. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 4 - --------------------------------------------------------- CLEARWINDOW statement --------------------------------------------------------- Purpose: Clears the current window inside the border. Syntax: CLEARWINDOW --------------------------------------------------------- FNATTR function --------------------------------------------------------- Purpose: Calculate the color attribute given the fore and background colors. Returns an integer value. Syntax: FNATTR(FORE,BACK) --------------------------------------------------------- MAKEBOX statement --------------------------------------------------------- Purpose: Draws a box on the screen. No screen saving performed. See MAKEWINDOW. Syntax: MAKEBOX(ROW,COL,ROWS,COLS,WATTR,BATTR,BORDER_ SATTR,SHADOW,ZOOM) Unique Variables: ZOOM - A "switch" to indicate if the window should zoom onto the screen. 0 - No, normal pop-up window. 1 - Yes, zoom to size. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 5 - --------------------------------------------------------- MAKEMENU statemenu --------------------------------------------------------- Purpose: Presents a highlighted bar menu in a previously opened window. Returns the position of the highlighted bar in an integer variable called CURNTPOS when the user makes a selection. Syntax: MAKEMENU Note: See the variable descriptions above that reference MAKEMENU and the demo program for a more detailed description of how to use this procedure. --------------------------------------------------------- MAKEWINDOW statement --------------------------------------------------------- Purpose: Open a text window on the screen with automatic screen saving. Syntax: MAKEWINDOW(ROW,COL,ROWS,COLS,WATTR,BATTR,BORDER_ SATTR,SHADOW,ZOOM) Unique Variables: ZOOM - A "switch" to indicate if the window should zoom onto the screen. 0 - No, normal pop-up window. 1 - Yes, zoom to size. --------------------------------------------------------- PRTWINDOW statement --------------------------------------------------------- Purpose: Display text in the current window using the current attributes and window coordinates. Syntax: PRTWINDOW(ROW,COL,STRDAT$) Note: ROW and COL refer to positions inside the window. ROW 1, COL 1 refers to upper left corner of the window. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 6 - --------------------------------------------------------- PRTCWINDOW statement --------------------------------------------------------- Purpose: Display text centered in the window on the ROW specified using the current attributes and window coordinates. Syntax: PRTCWINDOW(ROW,STRDAT$) Note: ROW refers to the row in the window. ROW 1 refers to the first row inside the border. --------------------------------------------------------- REMOVEWINDOW statement --------------------------------------------------------- Purpose: To remove the last window opened from the screen, restore the area under the window and restore the cursor position. Syntax: REMOVEWINDOW --------------------------------------------------------- TBWATTR statement --------------------------------------------------------- Purpose: To change the color attributes of a specified area of the screen. Syntax: TBWATTR(ROW,COL,ROWS,COLS,ATTR) --------------------------------------------------------- TBWBOX statement --------------------------------------------------------- Purpose: Draws a box on the screen of a specified size, border selection, border color attribute and window color attribute and save the screen area to memory. Syntax: TBWBOX(SAVFLG,ROW,COL,ROWS,COLS,WATTR,BATTR_ ,BORDER, SHADOW,ZOOM,SCRN()) CAUTION: Do not call this procedure by itself. It is used by MAKEWINDOW and MAKEBOX only. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 7 - --------------------------------------------------------- TBWFILL statement --------------------------------------------------------- Purpose: Fills a specified area of the screen with a specified character and color attribute. Syntax: TBWFILL(ROW,COL,ROWS,COLS,CHAR,ATTR) Unique Variables: CHAR - The integer value of the character you want displayed. --------------------------------------------------------- TBWPRINT statement --------------------------------------------------------- Purpose: Displays string data at a specified location with a specified color attribute. Syntax: TBWPRINT(ROW,COL,STRDAT$,ATTR) --------------------------------------------------------- TBWPRINTC statement --------------------------------------------------------- Purpose: Displays string data center within specified columns and on a specified row with a specified color attribute. Syntax: TBWPRINTC(ROW,COLL,COLR,STRDAT$,ATTR) Unique Variables: COLL and COLR refer to the left and right columns between which you want you data centered. --------------------------------------------------------- TBWRBOX statement --------------------------------------------------------- Purpose: To restore a specified area of the screen display from information stored in memory. Syntax: TBWRBOX(ROW,COL,ROWS,COLS,SHADOW,SCRN()) CAUTION: Do not call this procedure by itself. It is used by REMOVEWINDOW only. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 8 - --------------------------------------------------------- TBWBORDER statement --------------------------------------------------------- Purpose: Sets the text screen border to a specified color. Syntax: TBWBORDER(BACK) --------------------------------------------------------- TBWTITLE statement --------------------------------------------------------- Purpose: Handles all requests to TITLEWINDOW. Syntax: TBWTITLE(DIR,ROW,COL,ROWS,COLS,STRDAT$,ATTR) CAUTION: Do not call this procedure by itself. It is used by TITLEWINDOW only. --------------------------------------------------------- TITLEWINDOW statement --------------------------------------------------------- Purpose: To print a title in the border of a window using the border color attributes at a specified location. Syntax: TITLEWINDOW(LOC,ATTR,STRDAT$) Unique Variables: LOC - Specifies the location of the title 1 - Upper Left Corner 2 - Upper Center 3 - Upper Right Corner 4 - Lower Left Corner 6 - Lower Center 6 - Lower Right Corner --------------------------------------------------------- WINDOWXY statement --------------------------------------------------------- Purpose: Position the cursor within the current window. Syntax: WINDOWXY(ROW,COL) Note: ROW and COL refer to positions inside the window. ROW 1, COL 1 refers to upper left corner of the window. TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 9 - TBWINDO QUICK REFERENCE MakeWindow(Row%,Col%,Rows%,Cols%,Wattr%,Battr%,BrdrSel%, Shadow%,Zoom%) MakeBox(Row%,Col%,Rows%,Cols%,Wattr%,Battr%,BrdrSel%, Shadow%,Zoom%) TitleWindow(Loc%,Title$) RemoveWindow ClearWindow PrtWindow(Row%,Col%,StrDat$) PrtCWindow(Row%,StrDat$) FNAttr%(Fore%,Back%) WindowXY(Row%,Col%) MakeMenu TBWPrint(Row%,Col%,StrDat$,Attr%) TBWPrintC(Row%,ColLeft%,ColRight%,StrDat$,Attr%) TBWFill(Row%,Col%,Rows%,Cols%,Char%,Attr%) TBWAttr(Row%,Col%,Rows%,Cols%,Attr%) TBW60 / Copyright (c) 1988 by Richard D. Fothergill - 10 -