March 15, 1988 TPW60 MULTI-LEVEL WINDOWS FOR BORLANDS TURBO PASCAL Version 6.0 FILES In this version, TPW60.ARC contains TPW60.TPU - Turbo Pascal window unit TPW60.PAS - Source for TPW60.TPU TPW60.OBJ - Object for TPW60.TPU TPD60.PAS - Demonstration program TPW60.TXT - This document file. USING TPWINDO You can either leave the TPW60.TPU unit file as a stand-alone unit or put it in the TURBO.TPL library with the TPMOVER program. Include TPW60 in your uses statement. If you are using TPWINDOs and find it of value a contribution ($20.00) to the author is suggested. This will enable and encourage the further development of TPWINDOs. 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 TPW60 Copyright (c) 1988 Richard D. Fothergill - 1 - DEFINITIONS OF CONST, TYPES AND VARIABLES USED IN THE PROCEDURE AND FUNCTION DESCRIPTIONS: ATTR - integer value for the foreground and background color. See ATTR. BACK - integer value representing any one of PASCAL'S background colors. Valid numbers are 0 - 8. BATTR - integer value representing the border color attribute. 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. FORE - integer value representing any one of PASCAL's foreground colors. Valid numbers are 0 - 31. HIDECURSOR - constant value used by cursorchange to hide the cursor. ITEMLIST- an array of string data representing menu selections. MENUREC - user type defined as a record: item:itemlist - string array of menu selections itemcount - no. of items in menu startpos - starting position for selection bar curntpos - current position of highlight bar hlattr - color attribute of highlight bar flattr - color attribute of the first letter of each menu selection flon - boolean value indicating TPW60 Copyright (c) 1988 Richard D. Fothergill - 2 - whether first letter selection is active bartype - type of highlight bar, current selections are: 0 - no visible bar 1 - full width bar 2 - string width bar 3 - pointer MAXITEM - constant value representing the maximum items in a menu. MW - constant value representing the maximum windows you will have open. OLDCURSOR - integer value used to store the old cursor shape. 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 the 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 STRDAT - string data. WATTR - integer value representing the window color attribute. TPW60 Copyright (c) 1988 Richard D. Fothergill - 3 - --------------------------------------------------------- ATTR function --------------------------------------------------------- Purpose: Calculate the color attribute given the fore and background colors. Returns an integer value. Syntax: ATTR(FORE,BACK) --------------------------------------------------------- CLEARWINDOW procedure --------------------------------------------------------- Purpose: Clears the current window inside the border. Syntax: CLEARWINDOW --------------------------------------------------------- CURSORCHANGE procedure --------------------------------------------------------- Purpose: Alter the text screen cursor. Can be used to hide the cursor. Syntax: CURSORCHANGE(HIDECURSOR,OLDCURSOR) --------------------------------------------------------- EGA43 procedure --------------------------------------------------------- Purpose: Sets the display mode to 80 x 43 line EGA mode. Syntax: EGA43 Note: You can not use Pascals GotoXY command below the 25th line. All of the window routines in this library will work in this mode. Use TextMode(c80) to return to normal text. TPW60 Copyright (c) 1988 Richard D. Fothergill - 4 - --------------------------------------------------------- MAKEMENU procedure --------------------------------------------------------- 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(MENU) Note: MENU is a record of type MENUREC. See the notes above and the demo program for a more detailed description of how to use this procedure. --------------------------------------------------------- MAKEWINDOW / MAKEBOX procedure --------------------------------------------------------- Purpose: Open a text window on the screen and stores the area under the window in memory. MakeBox does the same except the area under the box is not saved and therefore can not be restored. 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 procedure --------------------------------------------------------- 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. TPW60 Copyright (c) 1988 Richard D. Fothergill - 5 - --------------------------------------------------------- PRTCWINDOW procedure --------------------------------------------------------- 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. --------------------------------------------------------- TPWATTR procedure --------------------------------------------------------- Purpose: To change the color attributes of a specified area of the screen. Syntax: TPWATTR(ROW,COL,ROWS,COLS,ATTR) --------------------------------------------------------- TPWBOX procedure --------------------------------------------------------- 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: TPWBOX(ROW,COL,ROWS,COLS,WATTR,BATTR,BORDER_ SATTR,SHADOW,ZOOM,SCRN^) CAUTION: Do not call this procedure by itself. It is used by MAKEWINDOW only. --------------------------------------------------------- TPWFILL procedure --------------------------------------------------------- Purpose: Fills a specified area of the screen with a specified character and color attribute. Syntax: TPWFILL(ROW,COL,ROWS,COLS,CHAR,ATTR) Unique Variables: CHAR - The integer value of the character you want displayed. TPW60 Copyright (c) 1988 Richard D. Fothergill - 6 - --------------------------------------------------------- TPWPRINT procedure --------------------------------------------------------- Purpose: Displays string data at a specified location with a specified color attribute. Syntax: TPWPRINT(ROW,COL,STRDAT,ATTR) --------------------------------------------------------- TPWPRINTC procedure --------------------------------------------------------- Purpose: Displays string data center within specified columns and on a specified row with a specified color attribute. Syntax: TPWPRINTC(ROW,COLL,COLR,STRDAT,ATTR) Unique Variables: COLL and COLR refer to the left and right columns between which you want you data centered. --------------------------------------------------------- TPWRBOX procedure --------------------------------------------------------- Purpose: To restore a specified area of the screen display from information stored in memory. Syntax: TPWRBOX(ROW,COL,ROWS,COLS,SCRN^) CAUTION: Do not call this procedure by itself. It is used by REMOVEWINDOW only. --------------------------------------------------------- REMOVEWINDOW procedure --------------------------------------------------------- Purpose: To remove the last window opened with MakeWindow from the screen, restore the area under the window and restore the cursor position. Syntax: REMOVEWINDOW TPW60 Copyright (c) 1988 Richard D. Fothergill - 7 - --------------------------------------------------------- TPWBORDER procedure --------------------------------------------------------- Purpose: Sets the text screen border to a specified color. Does not work with EGAs. Syntax: TPWBORDER(BACK) --------------------------------------------------------- TITLEWINDOW procedure --------------------------------------------------------- Purpose: To print a title in the border of a window using a specified color attribute 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 --------------------------------------------------------- VIDEOOFF procedure --------------------------------------------------------- Purpose: Blanks the video screen. Does not work on EGAs. Syntax: VIDEOOFF --------------------------------------------------------- VIDEOON procedure --------------------------------------------------------- Purpose: Restores the video screen. Does not work on EGAs. Syntax: VIDEOON TPW60 Copyright (c) 1988 Richard D. Fothergill - 8 - TPWINDO QUICK REFERENCE MakeWindow(Row,Col,Rows,Cols,Wattr,Battr,BrdrSel, Sattr,Shadow,Zoom) MakeBox(Row,Col,Rows,Cols,Wattr,Battr,BrdrSel, Sattr,Shadow,Zoom) MakeMenu(Menu) TitleWindow(Loc,Title) RemoveWindow ClearWindow PrtWindow(Row,Col,StrDat) PrtCWindow(Row,StrDat) Attr(Fore,Back) CursorChange(New,Old) TPWPrint(Row,Col,StrDat,Attr) TPWPrintC(Row,ColLeft,ColRight,StrDat,Attr) TPWFill(Row,Col,Rows,Cols,Char,Attr) TPWAttr(Row,Col,Rows,Cols,Attr) VideoOn VideoOff EGA43 TPW60 Copyright (c) 1988 Richard D. Fothergill - 9 -