PW200 Copyright (c) 1990 Richard D. Fothergill MULTI-LEVEL WINDOWS, MENUS AND UTILITIES for PowerBASIC Version 2.0 FILES on your disk: PW200d.PBU - PowerBASIC window unit file PD200.BAS - Demonstration program source code PD200.EXE - Compiled demonstration program PW200d.INC - PowerBASIC include file PWASMd.OBJ - Unit Object File USING PW200 All of the variables with the exception of string variables and long integers 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 PW200 subroutines are identified as integers, and you will be able to proceed with the compile operation as with any other program. Include PW200d.INC in your program with the $INCLUDE statement. Some of the functions require a good understanding of DOS interrupt calls. Consult any DOS programming reference manual for a more complete discussion. If a mouse is detected it will be active in all routines that use Getkey. The left button had been assigned CHR$(13) Enter, and the right button CHR$(27) Esc. CONVERTING FROM TBW73 If you have been using TBW73 for Borland's Turbo Basic the process of converting your programs is relatively easy. Any occurences of DEF FN's must be changed by dropping the FN off. These are now FUNCTIONS in PW200 instead of DEF FN. This change can be easily accomplished with a global search and replace. As an example, if you have CALL TEXTATTR(FNATTR(15,1)) in your program you should change it to read CALL TEXTATTR(ATTR(15,1)). These are the only statements that require alteration. WARRANTY AND DISCLAIMER The author makes 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. Any brand or product names are trademarks or registered trademarks of their respective holders. This is a demonstration file for evaluation only. Some features are not available and the maximum windows has been limited to three. This document file is a condensed version to give you a description of the statements and functions available in the registered version. You can order the registered version, which includes a printed manual, by sending $25.00 ($30.00 for 3-1/2" disk) plus $1.50 for shipping and handling to: Richard Fothergill 141 Oak Hill Road Pittsfield, MA 01201 Support for PW200 will be available to registered uses online through: GEnie - R.FOTHERGILL CServe - 76210,443 the Oak Hill BBS (413) 499-7245 -------------------------------------------------------------------- ATTR% function -------------------------------------------------------------------- Purpose Calculate the color attribute given the foreground and background colors. Returns an integer value. Syntax txtattr% = ATTR%(fg%,bg%) -------------------------------------------------------------------- BACK% function -------------------------------------------------------------------- Purpose Calculate the background color given a color attribute value. Returns an integer value. Syntax bkgrnd% = BACK%(wattr%) -------------------------------------------------------------------- CALCULATOR statement -------------------------------------------------------------------- Purpose Presents a four function with memory calculator in a pop-up window. Syntax CALL Calculator(row,col,wattr,shdw) -------------------------------------------------------------------- CLEARWIN statement -------------------------------------------------------------------- Purpose Clears the current window inside the border. Syntax CALL CLEARWIN -------------------------------------------------------------------- CLOSEWIN statement -------------------------------------------------------------------- Purpose To remove the last window opened from the screen, restore the area under the window and restore the cursor position. Syntax CALL CLOSEWIN -------------------------------------------------------------------- CURDIR$ function -------------------------------------------------------------------- Purpose Returns a string representing the DOS current directory in the form of Drive:\Dir\ Syntax cdir$ = Curdir$ -------------------------------------------------------------------- CURDISPLAY% function -------------------------------------------------------------------- Purpose Returns an integer value representing the type of the active monitor. 0 - MONO 3 - MCGA 1 - CGA 4 - VGA 2 - EGA Syntax vidtype% = CURDISPLAY% -------------------------------------------------------------------- CURDRIVE$ function -------------------------------------------------------------------- Purpose Returns a string representing the DOS current drive in the form of drive letter followed by a colon. Syntax cd$ = Curdrive$ -------------------------------------------------------------------- CURVIDEO% function -------------------------------------------------------------------- Purpose Returns an integer value representing the current video mode. Syntax vidmode% = CURVIDEO% -------------------------------------------------------------------- DISKFREE& function -------------------------------------------------------------------- Purpose Returns a long integer value representing the amount of free disk space on the drive specified. Syntax c& = Diskfree&(drive) -------------------------------------------------------------------- DISKSIZE& function -------------------------------------------------------------------- Purpose Returns a long integer value representing the size of the disk specified. Syntax c& = Disksize&(drive) -------------------------------------------------------------------- DOSVERSION$ function -------------------------------------------------------------------- Purpose Returns a string represent the version of the DOS on the machine in the form of Major.Minor. Syntax dos$ = Dosversion$ -------------------------------------------------------------------- FALIGN$ function -------------------------------------------------------------------- Purpose Formats a file name string to its full width of eight for the filename and three for the extension. Any missing characters are padded with spaces to form the string. Syntax filname$ = falign$(filspec$) -------------------------------------------------------------------- FAKEWIN statement -------------------------------------------------------------------- Purpose Draws a box on the screen. No screen saving performed. Syntax CALL FAKEWIN(ROW,COL,ROWS,COLS,WATTR,BATTR,BRDR,SATTR,_ SHDW,ZOOM) -------------------------------------------------------------------- FEXISTS% function -------------------------------------------------------------------- Purpose Returns an integer value(0 or 1) representing whether the file specified exists in the path and file spec given. Syntax filexists = Fexists(fspec$) -------------------------------------------------------------------- FEXPAND$ function -------------------------------------------------------------------- Purpose Expands a file specification into a fully qualified drive:\path\filespec by adding the current drive and directory. Syntax filpath$ = Fexpand$(filespec$) -------------------------------------------------------------------- FINDFIRST statement -------------------------------------------------------------------- Purpose Searches the path specification for the first entry matching the file specs and attributes. Results of the search are returned in dirinfo$ and doserror%. Syntax CALL Findfirst(path$,attrib%,dirinfo$,doserror%) -------------------------------------------------------------------- FINDNEXT statement -------------------------------------------------------------------- Purpose Returns the next entry that matches the file specs and attributes in a previous CALL to Findfirst. Syntax CALL Findnext(dirinfo$,doserror) -------------------------------------------------------------------- FORE% function -------------------------------------------------------------------- Purpose Calculate the foreground color given a color attribute value. Returns an integer value. Syntax frgrnd% = FORE%(wattr%) -------------------------------------------------------------------- FSPLIT statement -------------------------------------------------------------------- Purpose Splits a path specification in the three primary pieces. Drive, directory and file name. Syntax CALL Fsplit(path$,d$,n$,e$) -------------------------------------------------------------------- GETFIELD statement -------------------------------------------------------------------- Purpose Provide a formatted data input field. Syntax CALL GETFIELD(ROW,COL,ANS$,DTYPE$,SIZE,DEC,LSTKEY,_ INATTR,OUTATTR) -------------------------------------------------------------------- GETKEY statement -------------------------------------------------------------------- Purpose Get a key stroke from the keyboard. Returns CH1$ = to ASCII code if it is a printable character and CH2$ = CHR$(0). If an extended key is pressed returns CH1$ = CHR$(0) and CH2$ = extended key code. Syntax CALL GETKEY(CH1$,CH2$) -------------------------------------------------------------------- GETREC statement -------------------------------------------------------------------- Purpose Presents multiple fields for edited data input based on information provided in the descriptor array. Allows movement from field to field and action to be taken can be determined by the last key pressed. Syntax CALL Getrec(Info$(),Datarr$(),Trecs,Lstkey,Doedit,_ Inattr,Outattr) -------------------------------------------------------------------- MAKEFMENU$ function -------------------------------------------------------------------- Purpose Presents a pop-up menu of a directory of files matching the specification and attribute given from which a selection can be made. Returns the file selected or a null string if Esc is pressed. Syntax pikfil$ = Makefmenu$(fspec$,row,col,rows,wattr,battr,_ sattr,shdw,zoom,hlattr) -------------------------------------------------------------------- MAKEHMENU statement -------------------------------------------------------------------- Purpose Presents a horizontal menu within a previously open window. Returns an integer value which indicates the selection made. Syntax CALL MAKEHMENU(ITEM$(),SUBITEM$,ITEMCOUNT,CURNTPOS,_ STARTPOS,HLATTR,FLATTR,FLON,MENUSPACES,_ BARLOC) -------------------------------------------------------------------- MAKELMENU statement -------------------------------------------------------------------- Purpose Presents a vertical list within a previously open window. Returns an integer value which indicates the selection made. The list can be longer than the window with the direction keys controlling movement. Syntax CALL MAKELMENU(RECARR$(),RECS,PICKREC,STARTPOS,HLATTR) -------------------------------------------------------------------- MAKEVMENU statement -------------------------------------------------------------------- Purpose Presents a vertical menu within a previously open window. Returns an integer value which indicates the selection made. Syntax CALL MAKEVMENU(ITEM$(),LIVEITEM$,ITEMCOUNT,CURNTPOS,_ STARTPOS,HLATTR,FLATTR,NOATTR,BARTYPE,FLON) -------------------------------------------------------------------- MAXMEM& function -------------------------------------------------------------------- Purpose Returns a long integer representing the total conventional memory in the machine. Syntax maxbytes& = Maxmem& -------------------------------------------------------------------- OPENWIN statement -------------------------------------------------------------------- Purpose Open a text window on the screen with automatic screen saving. Syntax CALL OPENWIN(ROW,COL,ROWS,COLS,WATTR,BATTR,BRDR,SATTR,_ SHDW,ZOOM) -------------------------------------------------------------------- PRINTCWIN statement -------------------------------------------------------------------- Purpose Display text centered in the window on the ROW specified using the current attributes and window coordinates. Syntax CALL PRINTCWIN(ROW,STRDAT$) -------------------------------------------------------------------- PRINTWIN statement -------------------------------------------------------------------- Purpose Display text in the current window using the current attributes and window coordinates. Syntax CALL PRINTWIN(ROW,COL,STRDAT$) -------------------------------------------------------------------- PRTEST% function -------------------------------------------------------------------- Purpose Returns either a 0 - not ready or 1 - ready indicating the status of the printer port specified (either 1 or 2). Syntax prtok = Prtest(1) -------------------------------------------------------------------- SCOLOR statement -------------------------------------------------------------------- Purpose To change the color attributes of a specified area of the screen. Syntax CALL SCOLOR(ROW,COL,ROWS,COLS,ATTR) -------------------------------------------------------------------- SCROLLWIN statement -------------------------------------------------------------------- Purpose Scroll the current window either up or down one line. Syntax CALL SCROLLWIN(DIR$) -------------------------------------------------------------------- SFILL statement -------------------------------------------------------------------- Purpose Fills a specified area of the screen with a specified character and color attribute. Syntax CALL SFILL(ROW,COL,ROWS,COLS,CHAR,ATTR) -------------------------------------------------------------------- SPRINT statement -------------------------------------------------------------------- Purpose Displays string data at a specified location with a specified color attribute. Syntax CALL SPRINT(ROW,COL,STRDAT$,ATTR) -------------------------------------------------------------------- SPRINTC statement -------------------------------------------------------------------- Purpose Displays string data centered within specified columns and on a specified row with a specified color attribute. Syntax CALL SPRINTC(ROW,COLL,COLR,STRDAT$,ATTR) -------------------------------------------------------------------- TEXTATTR statement -------------------------------------------------------------------- Purpose Sets the text foreground and background based on a given attribute value. Syntax CALL TEXTATTR(ATTR) -------------------------------------------------------------------- TITLEWIN statement -------------------------------------------------------------------- Purpose To print a title in the border of a window using the color attribute specified at a specified location. Syntax CALL TITLEWIN(LOC,ATTR,STRDAT$) -------------------------------------------------------------------- WINDOWXY statement -------------------------------------------------------------------- Purpose Position the cursor within the current window. Syntax CALL WINDOWXY(ROW,COL)