December 28, 1987 TBWINDO MULTI-LEVEL WINDOWS FOR BORLANDS TURBO BASIC Version 4.0 FILES In this version, TBW40.ARC contains TBWINDO.INC - Turbo Basic window include file TBDEMO40.BAS - Demonstration program source code TBW40.TXT - This document file. README.1ST - Most recent changes and corrections. 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. 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. - 1 - 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. BRDRSEL - integer value representing the desired border type. Valid selections are: 0 - no border 1 - single line frame 2 - double line frame 3 - single horizontal, double vertical 4 - double horizontal, single vertical 5 - double line frame, arrow upper left corner COL - integer value representing the screen column, should be in the range of 2 - 79 COLS - integer value representing the number of columns wide. FORE - integer value representing any one of BASIC's foreground colors. Valid numbers are 0 - 31. ROW - integer value representing the screen row, should be in the range of 2 - 23. ROWS - integer value representing the number of rows long. STRDAT$ - string data. WATTR - integer value representing the window color attribute. NOTE: There is no parameter checking performed in any of the statements or functions. If string data exceeds the area specified it will spill out the sides. If parameters are out range of BASIC's limits you will either get error messages or very strange video results. - 2 - --------------------------------------------------------- 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) --------------------------------------------------------- MAKEMENU statement --------------------------------------------------------- Purpose: Creates a point and shoot type menu in a previously defined window. Returns an integer value in the variable CURNTPOS equal to the the menu item number selected. Syntax: MAKEMENU Unique Variables: Must be defined before the call. ITEM$() - An array of string data that you want displayed in the menu. ITEMCOUNT - Total elements in the ITEM$ array. STARTPOS - Default opening position of the selection bar. - 3 - --------------------------------------------------------- MAKEWINDOW statement --------------------------------------------------------- Purpose: Open a text window on the screen. Syntax: MAKEWINDOW(ROW,COL,ROWS,COLS,WATTR,BATTR,BRDRSEL_ ,SHADOW,ZOOM) Unique Variables: SHADOW - A "switch" to indicate if the window should have a shadow around it. 0 - No Shadow 1 - Left Solid Black 3 - Left Shadow Black 2 - Right Solid Black 4 - Right Shadow Black 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. --------------------------------------------------------- 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. - 4 - --------------------------------------------------------- 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. Syntax: TBWBOX(ROW,COL,ROWS,COLS,WATTR,BATTR) --------------------------------------------------------- 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) - 5 - --------------------------------------------------------- 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. --------------------------------------------------------- TBWREST statement --------------------------------------------------------- Purpose: To restore a specified area of the screen display from information stored in memory. Syntax: TBWREST(ROW,COL,ROWS,COLS,SCRN()) Unique Variables: SCRN() should be defined as an array of integers. --------------------------------------------------------- TBWSAVE statement --------------------------------------------------------- Purpose: To save a specified area of the screen in an integer array for later recall. Syntax: TBWSAVE(ROW,COL,ROWS,COLS,SCRN()) Unique Variables: SCRN() should be defined as an array of integers. --------------------------------------------------------- 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 - 6 - --------------------------------------------------------- TEXTBORDER statement --------------------------------------------------------- Purpose: Sets the text screen border to a specified color. Syntax: TEXTBORDER(BACK) --------------------------------------------------------- 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 5 - 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. - 7 - 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. Rick Fothergill 141 Oak Hill Road Pittsfield, MA 01201 - 8 - TBWINDO QUICK REFERENCE MakeWindow(Row%,Col%,Rows%,Cols%,Wattr%,Battr%,BrdrSel%, Shadow%,Zoom%) TitleWindow(Loc%,Title$) RemoveWindow ClearWindow MakeMenu PrtWindow(Row%,Col%,StrDat$) PrtCWindow(Row%,StrDat$) FNAttr%(Fore%,Back%) WindowXY(Row%,Col%) TBWSave(Row%,Col%,Rows%,Cols%,Scrn%(??)) TBWRest(Row%,Col%,Rows%,Cols%,Scrn%(??)) TBWPrint(Row%,Col%,StrDat$,Attr%) TBWPrintC(Row%,ColLeft%,ColRight%,StrDat$,Attr%) TBWFill(Row%,Col%,Rows%,Cols%,Char%,Attr%) TBWAttr(Row%,Col%,Rows%,Cols%,Attr%) TBWBox(Row%,Col%,Rows%,Cols%,Wattr%,Battr%,BrdrSel%) - 9 -