' +--------------------------------------------------------------------+ ' | | ' | M E S A M E N U P R O G R A M | ' | - - - - - - - - - - - - - - - | ' | Public Domain - FreeWare | ' +--------------------------------------------------------------------+ ' +--------------------------------------------------------------------+ ' | - ABOUT THE AUTHOR - | ' +--------------------------------------------------------------------+ ' | | ' | Hello. My name is Don Smith and I am a thirty-year retired teacher | ' | of Math/History/Spanish residing in Orange County, California. I | ' | am also a former six-year Sergeant of Marines. Who-Rah! On certain | ' | forums I am known as MarineDon.My email is: smithdonb@earthlink.net| ' | | ' +--------------------------------------------------------------------+ ' | - COPYING AND DISTIBUTING - | ' +--------------------------------------------------------------------+ ' | Since this code is public domain and freeware, anyone may freely | ' | copy and distribute it. If you use the QuickBasic code in one of | ' | your own programs, you do not have to cite my name as the author, | ' | and you may even change its name. | ' +--------------------------------------------------------------------+ ' +--------------------------------------------------------------------+ ' | MesaMenu was created by Don Smith on 08/01/2002. MesaMenu is | ' | declared Public Domain FreeWare. EMail: smithdonb@earthlink.net | ' | - - - - - - - - - - - - - - - - - - - - - - - - - | ' | Other programmers may use the included SUBs, or any other public | ' | domain program I have created, without naming me as the author. | ' | Programmers may even change the name of the program. It is my hope | ' | that any code written by me and used by another programmer will | ' | not be used for fee or profit. I do not insist on this; it is just | ' | something hoped for. If you are a programmer you'll probably need | ' | to change from "Info" to something like "Help". You will | ' | definitely want to modify lines 412 to 478. These lines are | ' | displayed when is pressed | ' +--------------------------------------------------------------------+ ' | Operation of MesaMenu: | ' | To operate MesaMenu, enter on the command line: MM + | ' | space + asterisk(*) + dot(.) + File Extension (and press ENTER). | ' | Example -> MM *.TXT In this case, MesaMenu will place all files | ' | ending with .TXT in a viewing menu. To view all files with all | ' | possible file extensions in a subdirectory, use: MM *.* Once in | ' | the menu, press to view an ASCII text file. To launch an | ' | executable file ending in EXE or COM, press . Unfortunately | ' | you will NOT be able to launch other programs ending in PDF, BMP | ' | and the like. To read helpful information, press . If no file | ' | extension is given, an error screen will pop up. | ' +--------------------------------------------------------------------+ ' | The six SUBs used in this program are all Public Domain, FreeWare. | ' | They do not need a special Library or Quick Library, just plain ol'| ' | QuickBASIC. Below is a brief description of each one. To find | ' | out more, visit each SUB and read the information at the top. | ' | | ' | (1) BoxBoy - All you need to make boxes or windows | ' | of various sizes, styles and shadows. | ' | (2) DisplayMessage - This SUB will make a scroll- | ' | able message on screen. SUB DisplayMessage can also | ' | be employed as a standalone program to view/browse | ' | short text files. For long text files, use SUB TrueView. | ' | (3) SUB TrueView is a complete text file viewer or browser | ' | which is able to view long files of, say, up to 10,000 | ' | lines in length. The amazing part is that it is able | ' | to do so without DIMing or REDIMing any memory, so that | ' | there are NO memory problems which so often occurs with | ' | QuickBASIC. TrueView may also be used as a standalone | ' | program on its own merit. | ' | (4) MesaMenu - Places on screen a table menu of | ' | designated items - this program. | ' | (5) SaveRestScrn - This SUB will save and or | ' | restore a portion or all the current screen. | ' | (6) EditLoco is a one-line editor which may also be used | ' | in password mode, displaying a series of these: ùùùù | ' +--------------------------------------------------------------------+ ' |The text file viewer and companion program is Trueview.Exe. Its | ' |basic code, TrueView.Bas, is also public domain freeware. It | ' |requires no special libraries, just QuickBASIC 4.5 | ' +--------------------------------------------------------------------+ ' +--------------------------------------------------------------------+ ' | Compile: | ' | BC MM /e (e for ON ERROR) | ' | | ' | LINK: MM | ' | LIB: BCom45 | ' +--------------------------------------------------------------------+ DEFINT A-Z '----------------------------------------------------------------------- DECLARE SUB BoxBoy (Title$, ULRow%, ULCol%, LRRow%, LRCol%, TitleRow%, TitleCol%, TitColrFor%, TitColrBak%, BoxColrFor%, BoxColrBak%, BoxStyle%, Shadow%, ShadowColr%, ClearColr%) DECLARE SUB DisplayMessage (Message$(), ULRow%, ULCol%, LRRow%, LRCol%, MaxNum%, ColrFG%, ColrBG%) DECLARE SUB EditLoco (EdW$, Row%, Col%, FCol%, LenStr%, See%, TypeOfText$, Caps%, FGColr%, BGColr%, FKey$, InS%, PW%, ExitCode%) DECLARE SUB MesaMenu (M$(), Start%, Count%, RegColrFG%, RegColrBG%, HiLiteFG%, HiLiteBG%, MaxScrRows%, MaxScrCols%, ColumnPointer%, TweenSpace%, TableULRow%, TableULCol%, CurrentRow%, CurrentCol%, ItemNum%, ItemWidth%, FKey$, ExitCode%) DECLARE SUB SaveRestScrn (ReadLine$(), ReadColr%(), SR.UL.Row%, SR.UL.Col%, SR.LR.Row%, SR.LR.Col%, SaveOrRest%) DECLARE SUB TrueView (FileName$, ULRow%, ULCol%, LRRow%, LRCol%, FGColr%, BGColr%, TBColrFG%, TBColrBG%, TBNumColrFG%, TBNumColrBG%, EOFColrFG%, EOFColrBG%) '----------------------------------------------------------------------- Exten$ = COMMAND$ begin: Exten$ = RTRIM$(LTRIM$(Exten$)) Exten$ = UCASE$(Exten$) IF LEFT$(Exten$, 2) <> "*." THEN 'incorrect DOS usage error GOTO errorhandler ELSEIF Exten$ = "" THEN 'blank parameter error GOTO errorhandler END IF make.short.menu: 'Next 9 lines checks for the existence of Exten$ SHELL "Dir" + " " + "/b" + " " + Exten$ + " " + ">" + " " + "FakeDir.Txt" OPEN "FakeDir.Txt" FOR APPEND AS #1 IF LOF(1) = 0 THEN 'file extention not on current directory CLOSE #1 KILL "FakeDir.Txt" GOTO errorhandler END IF CLOSE #1 KILL "FakeDir.Txt" 'Make a file, $$$$FAKE.EXE, with short truncated DOS names: SHELL "dir" + " " + Exten$ + " " + ">" + "$$$$FAKE.SM" OPEN "$$$$FAKE.SM" FOR INPUT AS #8 DO IF EOF(8) THEN EXIT DO END IF LINE INPUT #8, TossOut$ MaxNum% = MaxNum% + 1 LOOP UNTIL EOF(8) CLOSE 8 IF MaxNum% < 6 THEN GOTO errorhandler END IF OPEN "$$$$FAKE.SM" FOR INPUT AS #1 FOR GetRid% = 1 TO 5 LINE INPUT #1, TossOut$ NEXT REDIM M$(MaxNum%) SMNum% = 0 FOR InputShortM% = 1 TO MaxNum% - 6 IF EOF(1) THEN EXIT FOR END IF LINE INPUT #1, SMenu$ IF LEFT$(SMenu$, 8) <> "$$$$FAKE" AND MID$(SMenu$, 14, 1) <> "<" AND LEFT$(SMenu$, 1) <> "." AND LEFT$(SMenu$, 2) <> " " THEN SMenu$ = LEFT$(SMenu$, 12) SMenu$ = RTRIM$(LTRIM$(SMenu$)) SMNum% = SMNum% + 1 M$(SMNum%) = SMenu$ M$(SMNum%) = RTRIM$(LTRIM$(M$(SMNum%))) FOR DaSpc% = 1 TO 12 DaSpc$ = MID$(M$(SMNum%), DaSpc%, 1) IF DaSpc$ = " " THEN M$(SMNum%) = LEFT$(M$(SMNum%), DaSpc% - 1) + "." + RTRIM$(LTRIM$(RIGHT$(M$(SMNum%), 3))) EXIT FOR END IF NEXT END IF NEXT CLOSE #1 KILL "$$$$FAKE.SM" '====================================================================== ' SUB BoxBoy window routine '====================================================================== Title$ = " Files ending with " + Exten$ + " on current directory. " ULRow% = 3 ULCol% = 8 LRRow% = 18 LRCol% = 68 TitleRow% = 4 TitleCol% = 16 TitColrFor% = 15 TitColrBak% = 1 BoxColrFor% = 0 BoxColrBak% = 7 BoxStyle% = 2 Shadow% = 1 ShadowColr% = 8 ClearColr% = 1 CALL BoxBoy(Title$, ULRow%, ULCol%, LRRow%, LRCol%, TitleRow%, TitleCol%, TitColrFor%, TitColrBak%, BoxColrFor%, BoxColrBak%, BoxStyle%, Shadow%, ShadowColr%, ClearColr%) COLOR 14, 1: LOCATE 4, 36: PRINT Exten$ COLOR 0, 7 line$ = CHR$(199) + STRING$(60, CHR$(196)) + CHR$(182) LOCATE 16, 9: PRINT line$; COLOR 1, 7 LOCATE 17, 11, 0, 0, 0: PRINT " View"; LOCATE 17, 11, 0, 0, 0: COLOR 15, 7: PRINT "<"; LOCATE 17, 17, 0, 0, 0: COLOR 15, 7: PRINT ">"; LOCATE 17, 27, 0, 0, 0: COLOR 1, 7: PRINT " Launch"; LOCATE 17, 27, 0, 0, 0: COLOR 15, 7: PRINT "<"; LOCATE 17, 30, 0, 0, 0: COLOR 15, 7: PRINT ">"; LOCATE 17, 41, 0, 0, 0: COLOR 1, 7: PRINT " Extension"; LOCATE 17, 41, 0, 0, 0: COLOR 15, 7: PRINT "<"; LOCATE 17, 44, 0, 0, 0: COLOR 15, 7: PRINT ">"; LOCATE 17, 59, 0, 0, 0: COLOR 1, 7: PRINT " Info"; LOCATE 17, 59, 0, 0, 0: COLOR 15, 7: PRINT "<"; LOCATE 17, 63, 0, 0, 0: COLOR 15, 7: PRINT ">"; COLOR 0, 7 LOCATE 16, 24, 0, 0, 0: PRINT CHR$(194); LOCATE 17, 24, 0, 0, 0: PRINT CHR$(179); LOCATE 18, 24, 0, 0, 0: PRINT CHR$(207); LOCATE 16, 39, 0, 0, 0: PRINT CHR$(194); LOCATE 17, 39, 0, 0, 0: PRINT CHR$(179); LOCATE 18, 39, 0, 0, 0: PRINT CHR$(207); LOCATE 16, 57, 0, 0, 0: PRINT CHR$(194); LOCATE 17, 57, 0, 0, 0: PRINT CHR$(179); LOCATE 18, 57, 0, 0, 0: PRINT CHR$(207); CALL BoxBoy("", 21, 8, 23, 68, 1, 1, 1, 1, 15, 4, 2, 1, 7, 1000) COLOR 15, 4: LOCATE 22, 11 PRINT "MOVE: <" + CHR$(24) + "> <" + CHR$(25) + "> <" + CHR$(27) + "> <" + CHR$(26) + "> Exit"; COLOR 11, 4 LOCATE 22, 18, 0, 0, 0: PRINT CHR$(24); : LOCATE 22, 22: PRINT CHR$(25); LOCATE 22, 26, 0, 0, 0: PRINT CHR$(27); : LOCATE 22, 30: PRINT CHR$(26); LOCATE 22, 34, 0, 0, 0: PRINT "Home": LOCATE 22, 41: PRINT "End"; LOCATE 22, 47, 0, 0, 0: PRINT "PgDn"; : LOCATE 22, 54: PRINT "PgUp"; LOCATE 22, 61, 0, 0, 0: PRINT "Esc"; '====================================================================== ' MesaMenu routine - See SUB MesaMenu '====================================================================== Start% = 1 ' <- <- put Start% above "top" top: ' Count% = SMNum% ' RegColrFG% = 0 ' RegColrBG% = 7 ' HiLiteFG% = 15 ' HiLiteBG% = 0 ' +--------------------------------------+ MaxScrRows% = 10 ' | For an explanation of the items to | MaxScrCols% = 4 ' | the left, visit the MesaMenu SUB. | ColumnPointer% = 1 ' | | TweenSpace% = 2 ' +--------------------------------------+ TableULRow% = 6 ' TableULCol% = 13 ' CurrentRow% = 0 ' CurrentCol% = 0 ' ItemNum% = Start% ' ItemWidth% = 12 ' FKey$ = "570" ' ExitCode% = 0 begin.complete.menu: CALL MesaMenu(M$(), Start%, Count%, RegColrFG%, RegColrBG%, HiLiteFG%, HiLiteBG%, MaxScrRows%, MaxScrCols%, ColumnPointer%, TweenSpace%, TableULRow%, TableULCol%, CurrentRow%, CurrentCol%, ItemNum%, ItemWidth%, FKey$, ExitCode%) IF ExitCode% = 27 THEN ' COLOR 7, 0: CLS : LOCATE 1, 1, 1, 6, 7: END ELSEIF ExitCode% = 13 THEN ' GOSUB save.screen '+------------------------------------------------------------------+ ' The TrueView file viewer is used as a SUB in this program. It can ' also be used as a stand-alone program, in which case it would ' still be public domain and freeware. It requires no special ' libraries, just QuickBASIC 4.5 '+------------------------------------------------------------------+ ULRow% = 2 'Upper left row to place text. ULCol% = 1 'Upper left column to place text. LRRow% = 24 'Lower right row to place text. LRCol% = 80 'Lower right column to place text. FGColr% = 15 'Foreground color of text (0-15). BGColr% = 1 'Back ground color of text (0-7). TBColrFG% = 0 'Foreground color of top/bottom strips (0-15). TBColrBG% = 7 'Background color of the top/bottom strips (0-7). TBNumColrFG% = 0 'Foreground color of top line numbering (0-15). TBNumColrBG% = 7 'Background color of bottom line numbering (0-7). EOFColrFG% = 15 'Foreground color of "End Of File" message (0-15). EOFColrBG% = 4 'Background color of "End Of File" message (0-7). FileName$ = M$(ItemNum%) 'Name of file to view CALL TrueView(FileName$, ULRow%, ULCol%, LRRow%, LRCol%, FGColr%, BGColr%, TBColrFG%, TBColrBG%, TBNumColrFG%, TBNumColrBG%, EOFColrFG%, EOFColrBG%) GOSUB restore.screen Start% = ItemNum% FKey$ = "570" GOTO begin.complete.menu ELSEIF ExitCode% = 5 THEN ' '================================================================== ' Press - Launch executable '================================================================== GOSUB save.screen WhatEnd$ = RIGHT$(RTRIM$(LTRIM$(M$(ItemNum%))), 3) WhatEnd$ = UCASE$(WhatEnd$) '================================================================== ' If file is not .EXE, .COM or .BAT, back out '================================================================== IF WhatEnd$ <> "EXE" AND WhatEnd$ <> "COM" AND WhatEnd$ <> "BAT" THEN Title$ = "" ULRow% = 12 ULCol% = 10 LRRow% = 14 LRCol% = 65 TitleRow% = 4 TitleCol% = 19 TitColrFor% = 1 TitColrBak% = 7 BoxColrFor% = 15 BoxColrBak% = 1 BoxStyle% = 2 Shadow% = 1 ShadowColr% = 8 ClearColr% = 1000 CALL BoxBoy(Title$, ULRow%, ULCol%, LRRow%, LRCol%, TitleRow%, TitleCol%, TitColrFor%, TitColrBak%, BoxColrFor%, BoxColrBak%, BoxStyle%, Shadow%, ShadowColr%, ClearColr%) LOCATE 13, 14: COLOR 15, 1 PRINT "Can Only Launch: EXE, COM or BAT files. Press "; LOCATE 13, 61: COLOR 11, 1: PRINT "Esc"; DO: LOOP UNTIL INKEY$ = CHR$(27) GOSUB restore.screen Start% = ItemNum% FKey$ = "570" GOTO begin.complete.menu ELSE SHELL M$(ItemNum%) GOSUB restore.screen Start% = ItemNum% FKey$ = "570" GOTO begin.complete.menu END IF ELSEIF ExitCode% = 7 THEN '================================================================== ' Press - Change extension. Employ SUB EditLoco '================================================================== GOSUB save.screen CALL BoxBoy("Change Extention", 7, 19, 13, 54, 8, 31, 11, 1, 15, 1, 2, 1, 8, 1000) LOCATE 10, 23: COLOR 15, 1: PRINT "Type In 3-Character Extension:"; Row% = 12 Col% = 37 FCol% = 37 LenStr% = 3 See% = 0 TypeOfText$ = "" Caps% = 1 FGColr% = 15 BGColr% = 0 FKey$ = "" PW% = 0 InS% = 0 LOCATE Row%, Col%: COLOR 15, 0: PRINT " "; CALL EditLoco(EdW$, Row%, Col%, FCol%, LenStr%, See%, TypeOfText$, Caps%, FGColr%, BGColr%, FKey$, InS%, PW%, ExitCode%) IF ExitCode% = 27 THEN GOSUB restore.screen Start% = ItemNum% FKey$ = "570" GOTO begin.complete.menu END IF Exten$ = EdW$ Exten$ = "*." + Exten$ 'Next 9 lines checks for the existence of Exten$ SHELL "Dir" + " " + "/b" + " " + Exten$ + " " + ">" + " " + "FakeDir.Txt" OPEN "FakeDir.Txt" FOR APPEND AS #1 IF LOF(1) = 0 THEN 'file extention not on current directory CLOSE #1 KILL "FakeDir.Txt" GOSUB extension.error Start% = ItemNum% FKey$ = "570" GOTO begin.complete.menu END IF CLOSE #1 KILL "FakeDir.Txt" GOTO begin ELSEIF ExitCode% = 10 THEN '================================================================== ' Press - Show Program info, using SUB DisplayMessage. ' Command GOSUB program.info branches to the set up. '================================================================== GOSUB save.screen GOSUB program.info GOSUB restore.screen Start% = ItemNum% GOTO begin.complete.menu ELSE GOTO begin.complete.menu END IF extension.error: GOSUB restore.screen GOSUB save.screen CALL BoxBoy(" - Oops! -", 7, 19, 13, 54, 8, 33, 11, 4, 15, 4, 2, 1, 8, 1000) COLOR 15, 4 LOCATE 10, 23: PRINT "Unable to find " + Exten$ + " extension."; COLOR 11, 4 LOCATE 12, 23: PRINT "- Press any key to continue -"; COLOR 15, 4 LOCATE 12, 23: PRINT "-"; : LOCATE 12, 51: PRINT "-"; DO: LOOP WHILE INKEY$ = "" GOSUB restore.screen RETURN save.screen: REDIM ReadLine$(25) REDIM ReadColr%(25, 80) SR.UL.Row% = 1 SR.UL.Col% = 1 SR.LR.Row% = 25 SR.LR.Col% = 80 SaveOrRest% = 1 CALL SaveRestScrn(ReadLine$(), ReadColr%(), SR.UL.Row%, SR.UL.Col%, SR.LR.Row%, SR.LR.Col%, SaveOrRest%) RETURN restore.screen: SR.UL.Row% = 1 SR.UL.Col% = 1 SR.LR.Row% = 25 SR.LR.Col% = 80 SaveOrRest% = 2 CALL SaveRestScrn(ReadLine$(), ReadColr%(), SR.UL.Row%, SR.UL.Col%, SR.LR.Row%, SR.LR.Col%, SaveOrRest%) ERASE ReadLine$: ERASE ReadColr% RETURN errorhandler: CALL BoxBoy("<<>>", 2, 9, 16, 71, 3, 35, 12, 0, 15, 0, 1, 0, 7, 0) COLOR 15, 0 LOCATE 5, 20, 0, 0, 0: PRINT "Either no parameter was entered on the command" LOCATE 6, 20, 0, 0, 0: PRINT "line, or there were no matching files found. " COLOR 11, 0 LOCATE 8, 30, 0, 0, 0: PRINT "Example: MM *.TXT" COLOR 15, 0 LOCATE 10, 20, 0, 0, 0: PRINT "To view all the files on the current directory," LOCATE 11, 20, 0, 0, 0: PRINT "type Í" COLOR 11, 0 LOCATE 12, 40, 0, 0, 0: PRINT "MM *.* " LOCATE 15, 30: COLOR 14, 0: PRINT "Press Any Key To Exit." DO: LOOP WHILE INKEY$ = "" COLOR 7, 0: CLS : END make.noise: Melody = 100: Throat = 0 DO Throat = Throat + 1 FOR Melody = 600 TO 1000 STEP 300 '150 SOUND Melody, Melody / 1000 '1000 NEXT FOR Melody = 1000 TO 600 STEP -150 '-200 SOUND Melody, Melody / 1000 '1000 NEXT LOOP UNTIL Throat = 2 END program.info: Title$ = "" ULRow% = 4 ULCol% = 10 LRRow% = 16 LRCol% = 64 TitleRow% = 7 TitleCol% = 27 TitColrFor% = 11 TitColrBak% = 1 BoxColrFor% = 15 BoxColrBak% = 1 BoxStyle% = 1 Shadow% = 1 ShadowColr% = 8 ClearColr% = 1000 CALL BoxBoy(Title$, ULRow%, ULCol%, LRRow%, LRCol%, TitleRow%, TitleCol%, TitColrFor%, TitColrBak%, BoxColrFor%, BoxColrBak%, BoxStyle%, Shadow%, ShadowColr%, ClearColr%) line$ = CHR$(195) + STRING$(54, CHR$(196)) + CHR$(180) COLOR 15, 1 LOCATE 14, 11, 0, 0, 0: PRINT line$: COLOR 11, 1 LOCATE 15, 29, 0, 0, 0: PRINT "Press To Exit": COLOR 15, 1 LOCATE 15, 36, 0, 0, 0: PRINT "Esc" COLOR 14, 1 COLOR 14, 1 LOCATE 13, 30, 0, 0, 0: PRINT "Use <" + CHR$(24) + "> <" + CHR$(25) + "> Arrows" COLOR 15, 1 LOCATE 13, 35, 0, 0, 0: PRINT CHR$(24) LOCATE 13, 39, 0, 0, 0: PRINT CHR$(25) '-------------------- ULRow% = 5 ULCol% = 15 LRRow% = 14 'LRRow% - ULRow% - 1 LRCol% = 66 MaxNum% = 72 ColrFG% = 15 ColrBG% = 1 REDIM Message$(MaxNum% + 1) Message$(1) = SPACE$(45) Message$(2) = " MESAMENU PROGRAM " Message$(3) = " ---------------- " Message$(4) = "The purpose of the MesaMenu Program is to demon- " Message$(5) = "strate how to write the QuickBASIC code of a menu " Message$(6) = "consisting of a table of rows and columns. The " Message$(7) = "file extension will be placed as a parameter: " Message$(8) = SPACE$(45) Message$(9) = " Example -> MM *.TXT " Message$(10) = SPACE$(45) ' 1 2 3 4 5 6 ' 123456789012345678901234567890123456789012345678901 ' Message$(11) = "In this case, a menu will be displayed showing " Message$(12) = "a table of 10 rows and 4 columns containing all " Message$(13) = "files on the current directory with an extension " Message$(14) = "of .TXT To include all files, use Í MM *.* " Message$(15) = SPACE$(45) Message$(16) = "When I named the program I wanted a name that " Message$(17) = "would be consistent with DOS rules. I liked " 'NOTE: To use quotation marks within quotation marks in QuickBASIC, ' requires using ASCII character 34 = CHR$(34) Message$(18) = "using the word " + CHR$(34) + "table" + CHR$(34) + ", so I tried " + CHR$(34) + " TableMenu" + CHR$(34) + "." Message$(19) = "I changed this to " + CHR$(34) + "MesaMenu" + CHR$(34) + " to follow DOS" Message$(20) = "rules - no more that 8 characters in the name. " Message$(21) = "Also, " + CHR$(34) + "mesa" + CHR$(34) + " means " + CHR$(34) + "table" + CHR$(34) + " in Spanish. I" Message$(22) = "shortly changed this to " + CHR$(34) + "MM" + CHR$(34) + " as an abbreviation." Message$(23) = SPACE$(45) Message$(24) = "Check out MesaMenu's six SUBs:" Message$(25) = "------------------------------" Message$(26) = "(1) BoxBoy - All you need to make boxes or windows" Message$(27) = " of various sizes, styles and shadows. " Message$(28) = "(2) DisplayMessage - This SUB will make a scroll- " Message$(29) = " able message on screen - this message. " Message$(30) = "(3) SUB TrueView is a complete text file viewer" Message$(31) = " or browser which is able to view long files" Message$(32) = " of, say, up to 10,000 lines in length. The" Message$(33) = " amazing part is that it is able to do so with-" Message$(34) = " out DIMing or REDIMing any memory, so that" Message$(35) = " there are NO memory problems which so often" Message$(36) = " occurs with QuickBASIC. TrueView may also be" Message$(37) = " used as a standalone program on its own merit." Message$(38) = "(4) MesaMenu - Places on screen a table menu of " Message$(39) = " designated items - this program. " Message$(40) = "(5) SaveRestScrn - This SUB will save and or " Message$(41) = " restore a portion or all the current screen. " Message$(42) = "(6) EditLoco - A one-line editor with wrap. " Message$(43) = SPACE$(45) Message$(44) = "By the way, the entire MesaMenu Program and all " Message$(45) = "its SUBs require no special library or quick " Message$(46) = "library, just plain ol' QuickBASIC. " Message$(47) = SPACE$(45) Message$(48) = " Progam Information " Message$(49) = " ------------------ " Message$(50) = "The archival ZIP file, MM10.Exe, contains:" Message$(51) = "MM.Bas, MM.Exe, TrueView.Bas, TrueView.Exe, " Message$(52) = "Page.Bas, Page.Exe, BigPage.Bas, BigPage.Exe," Message$(53) = "MMList.Txt and ReadMe.Bat. These are all " Message$(54) = "Public Domain, FreeWare programs. In fact, " Message$(55) = "all included .BAS programs, SUBs and .EXE " Message$(56) = "programs are Public Domain, FreeWare. " Message$(57) = "Programmers, you need not give my name as the" Message$(58) = "author of these basic programs, SUBs or " Message$(59) = "executable programs. That is up to you. " Message$(60) = "You may change their names or modify them in " Message$(61) = "any way you wish. " Message$(62) = SPACE$(45) Message$(63) = " Author Information: " Message$(64) = " ------------------ " Message$(65) = "Hi! My name is Don Smith and I am a retired " Message$(66) = "thiry-year retired teacher of math/history/Spanish" Message$(67) = "residing in Orange County, California. I am also " Message$(68) = "a former six-year Sergeant of Marines. Who-Rah! " Message$(69) = "On certain forums I am known as MarineDon. " Message$(70) = SPACE$(45) Message$(71) = "Date: 08/01/2002. EMail: smithdonb@earthlink.net " Message$(72) = SPACE$(45) CALL DisplayMessage(Message$(), ULRow%, ULCol%, LRRow%, LRCol%, MaxNum%, ColrFG%, ColrBG%) RETURN SUB BoxBoy (Title$, ULRow%, ULCol%, LRRow%, LRCol%, TitleRow%, TitleCol%, TitColrFor%, TitColrBak%, BoxColrFor%, BoxColrBak%, BoxStyle%, Shadow%, ShadowColr%, ClearColr%) '+---------------------------------------------------------------------+ '| SUB BoxBoy | '+---------------------------------------------------------------------+ '| SUB written by Don Smith on March 25, 2002. Declared Public | '| Domain FreeWare. Other programmers may use this SUB without | '| naming me as the author. Don's EMail: smithdonb@earthlink.net | '| | '| This SUB only saves the underlying screen to repaint with a shadow. | '| So recommend using the SUB SaveRestScrn to save/restore screen. | '| Please read: SUB SaveRestScrn. | '+-------------+-------------------------------------------------------+ '| Title$ | The title of the menu. To make a box without a title,| '| | use: Title$ = "". When there is no Title, the cross | '| | bar is not deployed. | '|-------------+-------------------------------------------------------| '| ULRow% | The upper left row to place the box. | '|-------------+-------------------------------------------------------| '| ULCol% | The upper left column to place the box. | '|-------------+-------------------------------------------------------| '| LRRow% | The lower right row to place the box. | '|-------------+-------------------------------------------------------| '| LRCol% | The lower right column to place the box. | '|-------------+----------------------------------+--------------------| '| TitleRow% | The row to place the title. | If there is to be | '|-------------+----------------------------------| NO title, these 4 | '| TitleCol% | The column to place the title. | values will be | '|-------------+----------------------------------| ignored. If that | '| TitColrFor% | The foreground color of the title| is the case, these | '|-------------+----------------------------------| values may be | '| TitColrBak% | The background color of the title| omitted. | '|-------------+----------------------------------+--------------------| '| BoxColrFor% | The foreground color of the box itself. | '|-------------+-------------------------------------------------------| '| BoxColrBak% | The back ground color of the box. | '+-------------+-------------------------------------------------------+ '| Style% | Style% equals 1 - Single line around box | '| | Style% equals 2 - Double line around box | '+-------------+-------------------------------------------------------+ '| Shadow% | If Shadow% equals 0, there will be no shadow . | '| | If Shadow% equals 1, there will be a right shadow. | '| | If Shadow% equals 2, there will be a left shadow | '| +-------------------------------------------------------+ '| | NOTE #1: | '| | ------- | '| | When a shadow is used, the underlying text will | '| | be saved and printed with COLOR 8, 0 (very dim). | | '| | This causes the shadow to look like a real shadow. | '| | | '| | NOTE #2: | '| | ------- | '| | If the first four values of BoxBoy are 1, 1, 25, 89, | '| | in other words a full screen, please set Shadow% = 0 | '| | otherwise an error will result (no room for shadow). | '+-------------+-------------------------------------------------------+ '| ShadeColr% | The foreground color of the shadow. Usually | '| | this color is number 8. Using 8 allows the under- | '| | lying text to shine through. | '+-------------+-------------------------------------------------------+ '| ClearColr% | What color (0-7) to clear screen before making box. | '| | To disable this feature, use ClearColr% = 1000 | '| | | '| | COLOR VALUES: | '| | ---------------------------------- | '| | 0 is black 4 is red | '| | 1 is blue 5 is purple | '| | 2 is green 6 is orange | '| | 3 is light blue 7 is light white | '| | | '+-------------+-------------------------------------------------------+ IF ClearColr% <> 1000 THEN COLOR , ClearColr%: CLS END IF IF ULCol% <= 1 THEN ULCol% = 1 END IF IF LRCol% = 80 THEN LRCol% = 77 END IF make.box: IF BoxStyle% = 1 THEN 'Single Line ULCorner$ = CHR$(218) URCorner$ = CHR$(191) HorLine$ = CHR$(196) LeftSide$ = CHR$(195) RightSide$ = CHR$(180) VertLine$ = CHR$(179) LLCorner$ = CHR$(192) LRCorner$ = CHR$(217) ELSEIF BoxStyle% = 2 THEN 'Double Line ULCorner$ = CHR$(201) URCorner$ = CHR$(187) HorLine$ = CHR$(205) LeftSide$ = CHR$(199) RightSide$ = CHR$(182) VertLine$ = CHR$(186) LLCorner$ = CHR$(200) LRCorner$ = CHR$(188) END IF IF Shadow% = 1 THEN REDIM ReadLine$(25) FOR ViewIt% = ULRow% + 1 TO LRRow% + 1 FOR Horizon% = ULCol% + 2 TO LRCol% + 5 ReadLine$(ViewIt%) = ReadLine$(ViewIt%) + CHR$(SCREEN(ViewIt%, Horizon%)) NEXT NEXT COLOR ShadowColr%, 0 FOR Scratch% = ULRow% + 1 TO LRRow% + 1 LOCATE Scratch%, ULCol% + 2, 0, 0, 0 PRINT ReadLine$(Scratch%); NEXT ELSEIF Shadow% = 2 THEN REDIM ReadLine$(25) FOR ViewIt% = ULRow% + 1 TO LRRow% + 1 FOR Horizon% = ULCol% - 2 TO LRCol% + 1 ReadLine$(ViewIt%) = ReadLine$(ViewIt%) + CHR$(SCREEN(ViewIt%, Horizon%)) NEXT NEXT COLOR ShadowColr%, 0 FOR Scratch% = ULRow% + 1 TO LRRow% + 1 LOCATE Scratch%, ULCol% - 2, 0, 0, 0 PRINT ReadLine$(Scratch%); NEXT END IF Title.Length% = LEN(Title$) COLOR BoxColrFor%, BoxColrBak% 'ÚÄÄÄ¿ or ÉÍÍÍ» LOCATE ULRow%, ULCol%, 0, 0, 0 PRINT " " + ULCorner$ + STRING$(LRCol% - ULCol%, HorLine$) + URCorner$ + " "; '³ ³ or º º LOCATE ULRow% + 1, ULCol%, 0, 0, 0 PRINT " " + VertLine$ + SPACE$(LRCol% - ULCol%) + VertLine$ + " "; IF Title$ <> "" THEN 'ÃÄÄÄ´ or ÇÄÄĶ 'made cross bar if there is a title LOCATE ULRow% + 2, ULCol%, 0, 0, 0 PRINT " " + LeftSide$ + STRING$(LRCol% - ULCol%, 196) + RightSide$ + " "; ELSEIF Title$ = "" THEN LOCATE ULRow% + 2, ULCol%, 0, 0, 0 PRINT " " + VertLine$ + SPACE$(LRCol% - ULCol%) + VertLine$ + " "; END IF '³ ³ or º º FOR Print.Box% = 1 TO (LRRow% - ULRow%) - 3 LOCATE ULRow% + Print.Box% + 2, ULCol%, 0, 0, 0 PRINT " " + VertLine$ + SPACE$(LRCol% - ULCol%) + VertLine$ + " "; NEXT 'ÀÄÄÄÙ or ÈÍÍͼ LOCATE LRRow%, ULCol%, 0, 0, 0 PRINT " " + LLCorner$ + STRING$(LRCol% - ULCol%, HorLine$) + LRCorner$ + " "; IF Title$ <> "" THEN LOCATE TitleRow%, TitleCol%, 0, 0, 0 COLOR TitColrFor%, TitColrBak% PRINT Title$; END IF END SUB SUB DisplayMessage (Message$(), ULRow%, ULCol%, LRRow%, LRCol%, MaxNum%, ColrFG%, ColrBG%) '+---------------------------------------------------------------------+ '| DisplayMessage | '+---------------------------------------------------------------------+ '| The SUB DisplayMessage is a Public Domain, FreeWare program by | '| Don Smith. Date: 08/01/2002. EMail: smithdonb@earthlink.net | '+---------------------------------------------------------------------+ '| DisplayMessage will place a scrollable message on screen at the | '| row and column of choice. The message lines should be placed | '| in the main program together with a rediminsioning placed previous | '| to the message lines. Example-> REDIM Message$(MaxNum% +1). | '| With a bit of tweeking, this SUB should be able to be used as an | '| ASCII text viewer. | '+-------------+-------------------------------------------------------+ '| Message$ | Message lines to be placed in the main program. | '| | The number of message lines also must be | '| | rediminsioned in the main program. | '| | Example: REDIM Message$(58) | '+-------------+-------------------------------------------------------+ '| ULRow% | The upper left row to place message. | '+-------------+-------------------------------------------------------+ '| ULCol% | The upper left columnn to place message. | '+-------------+-------------------------------------------------------+ '| LRRow% | The lower right row of message. | '+-------------+-------------------------------------------------------+ '| LRCol% | The lower right column of message. | '+-------------+-------------------------------------------------------+ '| MaxNum% | The maximum number of message lines + 1. | '+-------------+-------------------------------------------------------+ '| ColrFG% | The foreground color of message. | '+-------------+-------------------------------------------------------+ '| ColrBG% | The back ground color of message. | '+-------------+-------------------------------------------------------+ COLOR ColrFG%, ColrBG% FOR place% = 1 TO LRRow% - ULRow% - 1 LOCATE place% + ULRow% - 1, ULCol%, 0, 0, 0 PRINT Message$(place%); NEXT DO DO Press$ = INKEY$ LOOP UNTIL LEN(Press$) > 0 Press% = CVI(Press$ + CHR$(0)) IF Press% = 27 THEN Where% = 0 EXIT SUB ELSEIF Press% = 20480 THEN 'DnArrow Where% = Where% + 1 IF Where% = MaxNum% - (LRRow% - ULRow% - 1) THEN '8 THEN SOUND 200, 2 END IF ELSEIF Press% = 18432 THEN 'UpArrow Where% = Where% - 1 IF Where% = -1 THEN SOUND 200, 2 END IF ELSEIF Press% = 20736 THEN 'PgDn Where% = Where% + (LRRow% - ULRow%) ELSEIF Press% = 18688 THEN 'PgUp Where% = Where% - (LRRow% - ULRow%) ELSEIF Press% = 20224 THEN 'End Where% = MaxNum% - 5 COLOR 15, 1 ELSEIF Press% = 18176 THEN 'Home Where% = 0 END IF GOSUB place.down LOOP place.down: COLOR 15, 1 FOR PlaceDn% = 1 TO LRRow% - ULRow% - 1 IF PlaceDn% + Where% - 1 = MaxNum% + 1 THEN RETURN ELSE IF Where% > MaxNum% - (LRRow% - ULRow%) THEN Where% = MaxNum% - (LRRow% - ULRow%) ELSEIF Where% <= 0 THEN Where% = 0 END IF LOCATE PlaceDn% + ULRow% - 1, ULCol%, 0, 0, 0 Work$ = LEFT$(Message$(PlaceDn% + Where%), LRCol% - ULCol%) Work$ = Work$ + SPACE$((LRCol% - ULCol%) - LEN(Work$)) PRINT Work$; END IF NEXT RETURN END SUB SUB EditLoco (EdW$, Row%, Col%, FCol%, LenStr%, See%, TypeOfText$, Caps%, FGColr%, BGColr%, FKey$, InS%, PW%, ExitCode%) STATIC ' +--------------------------------------------------------------------+ ' | SUB EditLoco: | ' +--------------------------------------------------------------------+ ' | This is a version of SUB EditString is called SUB EditLoco. The | ' | SUB EditString is compiled with the Pro.Lib from Cresent SoftWare.| ' | This version, called SUB EditLoco is compiled with regular ol' | ' | QuickBASIC v4.5 and needs no special library. | ' +--------------------------------------------------------------------+ ' | EdW$ | The string to be edited. | ' +--------------+-----------------------------------------------------+ ' | Row% | The row to begin the editing. | ' +--------------+-----------------------------------------------------+ ' | Col% | The column to begin the editing. | ' +--------------+-----------------------------------------------------+ ' | FCol% | Use same number as Col% | ' +--------------+-----------------------------------------------------+ ' | LenStr% | Length of the string to edit. | ' +--------------+-----------------------------------------------------+ ' | See% | If See% = 0 then existing text will be displayed. | ' | | If See% = 1 existing text will be wiped. | ' +--------------+-----------------------------------------------------+ ' | TypeOfText$ | For all ASCII characers 32 to 255, TypeOfText = "" | ' | | For numbers only, TypeOfText$ = "1234567890" | ' | | For numbers with commas and decimals points, | ' | | TypeOfText$ = ".,1234567890" | ' | | For Yes or No answers, TypeOfText$ = "YNyn" | ' | | Whatever is included within the parethesis | ' | | is what will be accepted. | ' +--------------+-----------------------------------------------------+ ' | Caps% | Capital letters enabled, Caps% = 1 | ' +--------------+-----------------------------------------------------+ ' | FGColr% | The text foreground color. | ' +--------------+-----------------------------------------------------+ ' | BGColr% | The text back ground color. | ' +--------------+-----------------------------------------------------+ ' | FKey$ | Which keys to enable. To enabled | ' | | and , FKey$ = "150" ("0" is F10). | ' +--------------+-----------------------------------------------------+ ' | PW% | PW% = 1 - password mode enabled. | ' | | PW% = 0 - password mode NOT enabled. | ' +--------------+-----------------------------------------------------+ ' | Ins% | Ins% = 0 then INSERT OFF. Ins% = 1 then INSERT ON | ' +--------------+-----------------------------------------------------+ ' | The ExitCode% is derived from the unique CVI Basic command. | ' | The ExitCode% for the keys gets changed to 101 to 110. | ' | To enable programmers to use the CVI code in their own programs, | ' | I have attached a short program, KeyCode.Bas (just below this | ' | section) | ' +------------------------------------+-------------------------------+ ' | ExitCode% = 101 is F1 key | I arbitrarily changed | ' | ExitCode% = 102 is F2 key | through to 101-110. | ' | ExitCode% = 103 is F3 key | Their CVI Codes are: | ' | ExitCode% = 104 is F4 key +-------------------------------+ ' | ExitCode% = 105 is F5 key | CVI: ExitCode: | ' | ExitCode% = 106 is F6 key | ---- --- -------- | ' | ExitCode% = 107 is F7 key | 15104 101 | ' | ExitCode% = 108 is F8 key | 15360 102 | ' | ExitCode% = 109 is F9 key | 15616 103 | ' | ExitCode% = 110 is F10 key | 15872 104 | ' | ExitCode% = 13 is ENTER key | 16128 105 | ' | ExitCode% = 18432 is Up Arrow | 16384 106 | ' | ExitCode% = 20480 is Down Arrow| 16640 107 | ' | ExitCode% = 9 is TAB key | 16896 108 | ' | ExitCode% = 27 is EXIT key | 17152 109 | ' | | 17408 110 | ' +------------------------------------+-------------------------------+ ' | Please include at the top of the routine DEFINT A-Z | ' +--------------------------------------------------------------------+ ' +--------------------------------------------------------------------+ ' | Use KeyCode.Bas below to find out what the CVI numbers will be | ' | for keys you wish to trap. | ' +--------------------------------------------------------------------+ ' | ' KeyCode.Bas - By Don Smith. FreeWare and Public Domain Program. | ' | ' Date: 09/01/2002. | ' | ' +-------------------------------------------------------------+ | ' | ' | Note: To reach the extended ASCII characters 127 to 255, | | ' | ' | press down on the key, and while pressed down, | | ' | ' | type in the number on your keypad, not the numbers | | ' | ' | above then keys. | | ' | ' +-------------------------------------------------------------+ | ' +--------------------------------------------------------------------+ ' | | ' | COLOR 14, 1: CLS | ' | Top1$ = "Press a key and the KeyCode% value will be displayed." | ' | Top2$ = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | ' | Top3$ = "(Press To Quit" | ' | COLOR 15, 1 | ' | LOCATE 2, 15: PRINT Top1$ | ' | LOCATE 3, 15: PRINT Top2$ | ' | COLOR 11, 1 | ' | LOCATE 4, 30, 0: PRINT Top3$ | ' | PRINT : PRINT | ' | COLOR 14, 1 | ' | DO | ' | DO | ' | Hit$ = INKEY$ | ' | IF Hit$ = CHR$(27) THEN | ' | PRINT | ' | LOCATE , 10: COLOR 15, 1: PRINT STRING$(62, "-"); | ' | PRINT | ' | LOCATE , 34: COLOR 11, 1: PRINT "Program Ends"; | ' | PRINT : PRINT | ' | END | ' | END IF | ' | LOOP UNTIL Hit$ <> "" | ' | Hit% = CVI(Hit$ + CHR$(0)) | ' | Key$ = STR$(Hit%) | ' | IF Hit% < 256 THEN | ' | LOCATE , 32, 0 | ' | PRINT Hit$ + SPACE$(9) + "= " + Key$ | ' | ELSEIF Hit% > 255 THEN | ' | LOCATE , 21, 0 | ' | PRINT "Extended Key" + SPACE$(9) + "= " + Key$; "" | ' | END IF | ' | LOOP | ' | | ' +--------------------------------------------------------------------+ EdW$ = "": Ky$ = "" IF See% = 1 THEN LOCATE Row%, Col% COLOR FGColr%, BGColr% PRINT STRING$(LenStr%, " "); END IF begin.edit.line: DO IF InS% = 1 THEN 'Insert On COLOR FGColr%, BGColr%: LOCATE Row%, Col%, 1, 4, 7 ELSEIF InS% = 0 THEN 'Insert Off COLOR FGColr%, BGColr%: LOCATE Row%, Col%, 1, 6, 7 END IF DO Ky$ = INKEY$ IF PW% = 1 THEN IF BlankIt% = 1 THEN BlankIt% = 0 END IF END IF LOOP UNTIL LEN(Ky$) > 0 SlamKey% = CVI(Ky$ + CHR$(0)) ' IF SlamKey% > 31 AND SlamKey% < 256 THEN 'CHR$(31) to CHR$255) IF TypeOfText$ = "" THEN 'CHR$(32) is IF PW% = 0 THEN GOSUB show.char ELSEIF PW% = 1 THEN GOSUB edit.password END IF ELSEIF TypeOfText$ <> "" THEN IF INSTR(TypeOfText$, Ky$) > 0 THEN IF PW% = 0 THEN GOSUB show.char ELSEIF PW% = 1 THEN GOSUB edit.password END IF END IF END IF ELSEIF SlamKey% = 27 THEN ' Key ExitCode% = 27 GOSUB get.string EXIT SUB ELSEIF SlamKey% = 19712 THEN ' Arrow Col% = Col% + 1 IF Col% > FCol% + LenStr% - 1 THEN Col% = FCol% ELSE LOCATE Row%, Col%, 1, 6, 7 END IF ELSEIF SlamKey% = 19200 THEN ' Col% = Col% - 1 IF Col% = FCol% - 1 OR Col% < FCol% THEN Col% = FCol% + LenStr% - 1 END IF ELSEIF SlamKey% = 13 THEN ' IF PW% = 0 THEN GOSUB get.string END IF ExitCode% = 13 EXIT SUB ' or or - If not used, REM these 3 out. ELSEIF SlamKey% = 9 OR SlamKey% = 18432 OR SlamKey% = 20480 THEN GOSUB get.string ExitCode% = SlamKey% EXIT SUB ELSEIF SlamKey% = 8 THEN ' Col% = Col% - 1 IF Col% = FCol% OR Col% < FCol% THEN Col% = FCol% END IF LOCATE Row%, Col% COLOR FGColr%, BGColr%: PRINT " "; IF PW% = 1 THEN EdW$ = LEFT$(EdW$, LEN(EdW$) - 1) END IF ELSEIF SlamKey% = 20992 THEN ' 'If 1 (on), turn off (0). If 0 (off), turn on (1). IF InS% = 1 THEN InS% = 0 'unREM if need to print "Insert Off/On" 'LOCATE 2, 66: Print "Insert Off "; ELSEIF InS% = 0 THEN 'REM out "Insert Off/On" if not used. InS% = 1 'LOCATE 2, 66: Print "Insert On "; END IF ELSEIF SlamKey% = 21248 THEN ' FOR DelK% = Col% + 1 TO FCol% + LenStr% SaveScr$ = SaveScr$ + CHR$(SCREEN(Row%, DelK%)) NEXT SaveScr$ = MID$(SaveScr$, 1, LEN(SaveScr$) - 1) LOCATE Row%, Col% COLOR FGColr%, BGColr% PRINT EdW$ + SaveScr$; SaveScr$ = "" ELSEIF SlamKey% = 18176 THEN ' Col% = FCol% ELSEIF SlamKey% = 20224 THEN ' GOSUB get.string Col% = FCol% + LEN(EdW$) LOCATE Row%, Col%, 1, 6, 7 ELSEIF SlamKey% = 25 THEN ' = clears line of LOCATE Row%, FCol% 'all text. WipeOut$ = SPACE$(LenStr%) COLOR FGColr%, BGColr% PRINT WipeOut$; ELSEIF SlamKey% > 15103 OR SlamKey% < 17409 THEN ' to IdentKey$ = STR$(((SlamKey% - 15104) \ 256) + 1) IdentKey$ = LTRIM$(RTRIM$(IdentKey$)) IF IdentKey$ = "10" THEN IdentKey$ = "0" END IF IF INSTR(FKey$, IdentKey$) > 0 THEN IF IdentKey$ = "0" THEN ExitCode% = 110 GOSUB get.string EXIT SUB ELSE ExitCode% = VAL(IdentKey$) + 100 GOSUB get.string EXIT SUB END IF END IF END IF LOOP show.char: IF InS% = 1 THEN ' FOR Horizontal% = Col% TO FCol% + LenStr% - 1 EditL$ = EditL$ + CHR$(SCREEN(Row%, Horizontal%)) NEXT IF Caps% > 0 THEN EditL$ = UCASE$(EditL$) Ky$ = UCASE$(Ky$) END IF COLOR FGColr%, BGColr% LOCATE Row%, Col%, 1 PRINT LEFT$(Ky$ + EditL$, FCol% + LenStr% - Col%); IF Col% = FCol% + LenStr% THEN Col% = FCol% - 1 END IF Col% = Col% + 1 EditL$ = "" ELSEIF InS% = 0 THEN ' LOCATE Row%, Col% IF Caps% > 0 THEN COLOR FGColr%, BGColr%: PRINT UCASE$(Ky$); ELSEIF Caps% = 0 THEN COLOR FGColr%, BGColr%: PRINT Ky$; END IF Col% = Col% + 1 IF Col% = FCol% + LenStr% THEN Col% = FCol% RETURN END IF END IF RETURN get.string: EditLine$ = SPACE$(LenStr%) FOR Horizontal% = FCol% TO FCol% + LenStr% EditLine$ = EditLine$ + CHR$(SCREEN(Row%, Horizontal%)) NEXT EditLine$ = LTRIM$(RTRIM$(EditLine$)) EdW$ = EditLine$ RETURN edit.password: EdW$ = UCASE$(EdW$) + UCASE$(Ky$) COLOR FGColr%, BGColr% LOCATE Row%, Col% PRINT "ù"; 'CHR$(249) LOCATE Row%, Col% + 1, 1, 6, 7 IF Col% = FCol% + LenStr% THEN Col% = FCol% - 1 END IF Col% = Col% + 1 RETURN END SUB SUB MesaMenu (M$(), Start%, Count%, RegColrFG%, RegColrBG%, HiLiteFG%, HiLiteBG%, MaxScrRows%, MaxScrCols%, ColumnPointer%, TweenSpace%, TableULRow%, TableULCol%, CurrentRow%, CurrentCol%, ItemNum%, ItemWidth%, FKey$, ExitCode%) ' +--------------------------------------------------------------------+ ' | MesaMenu was created by Don Smith on 08/01/2002. MesaMenu is | ' | declared Public Domain FreeWare. | ' | - - - - - - - - - - - - - - - - - - - - - - - - | ' | The MesaMenu SUB seems long, but with all the REM lines removed, | ' | it is just 254 lines in length. | ' | - - - - - - - - - - - - - - - - - - - - - - - - | ' | The MesaMenu name is abbreviated as MM to make it easier to | ' | enter at the command prompt. | ' | - - - - - - - - - - - - - - - - - - - - - - - - | ' | The object of MesaMenu is to display on screen a table menu | ' | of selected items. These may be files on the current directory, | ' | or other menu choices. Enter as a parameter a group of files | ' | which have a common extension. Example: "MM *.txt"(without quotes)| ' | For this example, MM.EXE will bring up in a viewing window all | ' | files on the current directory having the extension of .TXT. Find | ' | the word "Exten$" 14 lines from the top of the main program | ' | To view ALL the files on the current directory, use "MM *.*" | ' | To change to your QuickBASIC files, use "MM *.bas" To view files | ' | with NO extension, use "MM *." . If the DOS command, "DIR *." | ' | is used at the prompt, it will display all directories and files | ' | having no extensions. | ' | - - - - - - - - - - - - - - - - - - - - - - - - | ' | The program user may move the block cursor by pressing: | ' | . In | ' | addition, the user may press a letter, a number, an exclamation | ' | , or an underline <_>. The hi-lite cursor | ' | will jump to the first item beginning with the letter pressed, | ' | and, if there are any more items beginning with that letter, it | ' | will move down at each press of that letter. This SUB is not | ' | set up to use a mouse. | ' | - - - - - - - - - - - - - - - - - - - - - - - - | ' | If you press or the SUB will exit and a screen | ' | will be displayed. To find out how to use all the keys, | ' | refer to FKey$ below. | ' +----------------+---------------------------------------------------+ ' | M$() | Menu Item. In main program rediminsion: | ' | | REDIM M$(MaxNum% + 10) | ' +----------------+---------------------------------------------------+ ' | Start% | Which item to hi-light first. | ' +----------------+---------------------------------------------------+ ' | Count% | Count of total menu items. | ' +----------------+---------------------------------------------------+ ' | RegColrFG% | Regular fore ground color. | ' +----------------+---------------------------------------------------+ ' | RegColrBG% | Regular background color. | ' +----------------+---------------------------------------------------+ ' | HiLiteFG% | Hi-light foreground color. | ' +----------------+---------------------------------------------------+ ' | HiLiteBG% | Hi-light background color. | ' +----------------+---------------------------------------------------+ ' | MaxScrRows% | Number of rows to display on screen. | ' +----------------+---------------------------------------------------+ ' | MaxScrCols% | Number of columns to display on screen. | ' +----------------+---------------------------------------------------+ ' | ColumnPointer% | Points to current column in use. | ' +----------------+---------------------------------------------------+ ' | TweenSpace% | Number of spaces between columns. | ' +----------------+---------------------------------------------------+ ' | TableULRow% | Upper left row to place menu. | ' +----------------+---------------------------------------------------+ ' | TableULCol% | Upper left column to place menu. | ' +----------------+---------------------------------------------------+ ' | CurrentRow% | Current row of hi-light item. | ' +----------------+---------------------------------------------------+ ' | CurrentCol% | Current column of hi-light item. | ' +----------------+---------------------------------------------------+ ' | ItemNum% | Menu item number of the hi-lighted item. | ' | | In main program Start% and ItemNum% should be | ' | | the same. | ' +----------------+---------------------------------------------------+ ' | ItemWidth% | Width of menu items. | ' +----------------+---------------------------------------------------+ ' | FKey$ | To exit when an key is pressed, designate | ' | | the keys by placing them between paranthesis. | ' | | Example: FKey$ = "150". This means the SUB will | ' | | exit on pressing , or . The "0" | ' | | means "10". In the main program, indicate the | ' | | keys with ExitCode%. to is | ' | | ExitCode% = 1 to ExitCode% = 10. | ' | | | ' | | Example: | ' | | ------- | ' | | IF ExitCode% = 1 THEN ' | ' | | GOSUB save.screen | ' | | COLOR 15, 1: CLS | ' | | LOCATE 2, 33 | ' | | PRINT "Help Screen" | ' | | DO: LOOP WHILE INKEY$ = "" | ' | | GOSUB restore.screen | ' | | Start% = ItemNum% | ' | | GOTO begin.complete.menu | ' | | END IF | ' +----------------+---------------------------------------------------+ ' | ExitCode% | The exit number as explained below. | ' +--------------------------------------------------------------------+ ' | In the code below this REM (') section, find the area beginning | ' | "da.loop" and notice the keys trap below it. In QuickBASIC | ' | it is very easy to trap for any key on the keyboard by using the | ' | CVI command. It is accomplished through the use of a double | ' | DO/LOOP and then a series of IF/THENs (See Example). | ' | | ' | Example: | ' | ------- | ' | COLOR 15, 1: CLS | ' | PRINT "Press or X. To exit, press " | ' | PRINT | ' | DO | ' | DO | ' | Hit$ = INKEY$ | ' | LOOP UNTIL LEN(Hit$) > 0 | ' | Hit% = CVI(Hit$ + CHR$(0)) | ' | IF Hit% = 27 THEN ' | ' | CLS : END | ' | ELSEIF Hit% = 15104 THEN ' | ' | PRINT "F1 - Yeah!" | ' | ELSEIF Hit% = 24 THEN ' or | ' | PRINT "Ctrl-X. Yeah!" | ' | END IF | ' | LOOP | ' | | ' +--------------------------------------------------------------------+ ' | Use the KEYCODE.BAS program below to find the CVI numbers for | ' | the keys you need to trap. | ' +--------------------------------------------------------------------+ ' | ' KeyCode.Bas - By Don Smith. FreeWare and Public Domain Program. | ' | ' | ' | ' +-------------------------------------------------------------+ | ' | ' | Note: To reach the extended ASCII characters 127 to 255, | | ' | ' | press down on the key, and while pressed down, | | ' | ' | type in the number on your keypad, not the numbers | | ' | ' | above then keys. | | ' | ' +-------------------------------------------------------------+ | ' | | ' | COLOR 15, 1: CLS | ' | Top1$ = "Press a key and the KeyCode% value will be displayed." | ' | Top2$ = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | ' | Top3$ = "(Press To Quit" | ' | COLOR 15, 1 | ' | LOCATE 2, 15: PRINT Top1$ | ' | LOCATE 3, 15: PRINT Top2$ | ' | COLOR 11, 1 | ' | LOCATE 4, 30, 0: PRINT Top3$ | ' | PRINT : PRINT | ' | COLOR 14, 1 | ' | DO | ' | DO | ' | Hit$ = INKEY$ | ' | IF Hit$ = CHR$(27) THEN | ' | PRINT | ' | LOCATE , 10: COLOR 15, 1: PRINT STRING$(62, "-"); | ' | PRINT | ' | LOCATE , 34: COLOR 11, 1: PRINT "Program Ends"; | ' | PRINT : PRINT | ' | END | ' | END IF | ' | LOOP UNTIL Hit$ <> "" | ' | Hit% = CVI(Hit$ + CHR$(0)) | ' | Key$ = STR$(Hit%) | ' | IF Hit% < 256 THEN | ' | LOCATE , 32, 0 | ' | PRINT Hit$ + SPACE$(9) + "= " + Key$ | ' | ELSEIF Hit% > 255 THEN | ' | LOCATE , 21, 0 | ' | PRINT "Extended Key" + SPACE$(9) + "= " + Key$; "" | ' | END IF | ' | LOOP | ' | | ' +--------------------------------------------------------------------+ FOR EqWidth% = 1 TO Count% M$(EqWidth%) = M$(EqWidth%) + SPACE$(ItemWidth% - LEN(M$(EqWidth%))) NEXT subtop: DivideIt% = Count% \ MaxScrRows% Remainder% = Count% MOD MaxScrRows% IF Remainder% > 0 THEN Remainder% = 1 END IF NumColsPossible% = DivideIt% + Remainder% LeftOver% = Count% MOD MaxScrRows% 'Count of items of last row IF Start% = 1 THEN CurrentRow% = TableULRow% CurrentCol% = TableULCol% ColumnPointer% = 1 ELSE LocateRow% = Start% MOD MaxScrRows% IF LocateRow% = 0 THEN LocateRow% = MaxScrRows% ColumnPointer% = (Start% \ MaxScrRows%) ELSE ColumnPointer% = (Start% \ MaxScrRows%) + 1 END IF CurrentRow% = TableULRow% + LocateRow% - 1 LocateCol% = (Start% \ MaxScrRows%) IF Start% MOD MaxScrRows% > 0 THEN LocateCol% = LocateCol% + 1 END IF IF LocateCol% > MaxScrCols% THEN LocateCol% = LocateCol% - MaxScrCols% FOR Spy% = 1 TO NumColsPossible% IF LocateCol% > MaxScrCols% THEN LocateCol% = LocateCol% - MaxScrCols% END IF IF LocateCol% <= MaxScrCols% THEN EXIT FOR END IF NEXT TheFactor% = ColumnPointer% \ MaxScrCols% IF ColumnPointer% MOD MaxScrCols% = 0 THEN show% = (MaxScrCols% * MaxScrRows%) * (TheFactor% - 1) ELSE show% = (MaxScrCols% * MaxScrRows%) * TheFactor% END IF IF LocateCol% <= 1 THEN CurrentCol% = TableULCol% END IF END IF END IF IF CurrentCol% < TableULCol% THEN CurrentCol% = TableULCol% + ((LocateCol% - 1) * (ItemWidth% + TweenSpace%)) END IF bring.in.display: FOR display% = TableULRow% TO TableULRow% + MaxScrRows% - 1 COLOR RegColrFG%, RegColrBG% LOCATE display%, TableULCol%, 0, 0, 0 show% = show% + 1 IF show% <= Count% THEN PRINT M$(show%) + SPACE$(TweenSpace%); ELSE PRINT SPACE$(ItemWidth% + TweenSpace%); END IF FOR ExecuteNext% = 1 TO MaxScrCols% - 1 IF show% + (ExecuteNext% * MaxScrRows%) <= Count% THEN IF LEN(M$(show% + (ExecuteNext% * MaxScrRows%))) = ItemWidth% THEN PRINT M$(show% + (ExecuteNext% * MaxScrRows%)) + SPACE$(TweenSpace%); ELSEIF LEN(M$(show% + (ExecuteNext% * MaxScrRows%))) = 0 THEN PRINT SPACE$(ItemWidth% + TweenSpace%); END IF ELSE IF Count% > (MaxScrRows% * MaxScrCols%) THEN PRINT SPACE$(ItemWidth% + TweenSpace%); END IF END IF NEXT NEXT COLOR HiLiteFG%, HiLiteBG% LOCATE CurrentRow%, CurrentCol%, 0, 0, 0 PRINT M$(ItemNum%) da.loop: DO DO HitKey$ = INKEY$ LOOP UNTIL LEN(HitKey$) > 0 Hit% = CVI(HitKey$ + CHR$(0)) LOCATE CurrentRow%, CurrentCol%, 0, 0, 0 COLOR RegColrFG%, RegColrBG% PRINT M$(ItemNum%); IF Hit% = 27 THEN ' ExitCode% = 27 EXIT SUB ELSEIF Hit% = 13 THEN ' ExitCode% = 13 EXIT SUB ELSEIF Hit% = 20480 THEN ' IF LeftOver% = 0 AND ItemNum% = Count% THEN CurrentRow% = TableULRow% - 1 ItemNum% = Count% - MaxScrRows% END IF IF ItemNum% < Count% THEN CurrentRow% = CurrentRow% + 1 ItemNum% = ItemNum% + 1 IF CurrentRow% = TableULRow% + MaxScrRows% THEN CurrentRow% = TableULRow% ItemNum% = ItemNum% - MaxScrRows% END IF ELSE CurrentRow% = TableULRow% ItemNum% = Count% - LeftOver% + 1 END IF ELSEIF Hit% = 18432 THEN ' CurrentRow% = CurrentRow% - 1 ItemNum% = ItemNum% - 1 IF CurrentRow% = TableULRow% - 1 THEN CurrentRow% = TableULRow% + MaxScrRows% - 1 ItemNum% = ItemNum% + MaxScrRows% IF ItemNum% > Count% THEN ItemNum% = Count% CurrentRow% = TableULRow% + LeftOver% - 1 END IF END IF ELSEIF Hit% = 19712 THEN ' IF ItemNum% <= Count% - LeftOver% THEN CurrentCol% = CurrentCol% + TweenSpace% + ItemWidth% ItemNum% = ItemNum% + MaxScrRows% ColumnPointer% = ColumnPointer% + 1 IF ItemNum% > Count% THEN ItemNum% = Count% IF LeftOver% = 0 THEN CurrentCol% = CurrentCol% - (TweenSpace% + ItemWidth%) CurrentRow% = TableULRow% + MaxScrRows% - 1 ItemNum% = Count% ColumnPointer% = ColumnPointer% - 1 ELSEIF LeftOver% > 0 THEN CurrentRow% = TableULRow% + LeftOver% - 1 END IF END IF END IF IF ColumnPointer% > MaxScrCols% THEN Start% = ItemNum% show% = 0 ColumnPointer% = 0 GOTO subtop END IF ELSEIF Hit% = 19200 THEN ' IF ColumnPointer% <= 0 THEN ColumnPointer% = 1 END IF IF ColumnPointer% > 1 THEN CurrentCol% = CurrentCol% - (TweenSpace% + ItemWidth%) ItemNum% = ItemNum% - MaxScrRows% ColumnPointer% = ColumnPointer% - 1 END IF IF ColumnPointer% >= MaxScrCols% THEN ColumnPointer% = 0 Start% = ItemNum% show% = 0 GOTO subtop END IF ELSEIF Hit% = 18176 THEN ' CurrentRow% = 0 CurrentCol% = 0 show% = 0 ItemNum% = 1 Start% = 1 GOTO subtop ELSEIF Hit% = 20224 THEN ' show% = 0 ItemNum% = Count% Start% = Count% CurrentCol% = 0 GOTO subtop ELSEIF Hit% = 20736 THEN ' ItemNum% = ItemNum% + (MaxScrRows% * MaxScrCols%) IF ItemNum% > Count% THEN ItemNum% = Count% END IF Start% = ItemNum% CurrentCol% = 0 show% = 0 GOTO subtop ELSEIF Hit% = 18688 THEN ' ItemNum% = ItemNum% - (MaxScrRows% * MaxScrCols%) IF ItemNum% <= 0 THEN ItemNum% = 1 END IF Start% = ItemNum% CurrentCol% = 0 show% = 0 GOTO subtop 'PRESS: Letters A - Z (or a - z), Numbers 0 - 9, ' Exclamation , or Underline <_>. ELSEIF Hit% > 64 AND Hit% < 91 OR Hit% > 96 AND Hit% < 123 OR Hit% > 47 AND Hit% < 58 OR Hit% = 33 OR Hit% = 95 THEN IF Hit% > 96 AND Hit% < 123 THEN Hit% = Hit% - 32 END IF FOR XYZ% = 1 TO Count% Letr$ = LEFT$(M$(XYZ%), 1) IF XYZ% = Count% AND ASC(Letr$) <> Hit% THEN show% = 0 GOTO subtop ELSEIF ASC(Letr$) = Hit% THEN EXIT FOR END IF NEXT FOR YYY% = 1 TO Count% CurrentLetr$ = LEFT$(M$(ItemNum%), 1) IF CurrentLetr$ <> FindLetr$ THEN TryLetters% = 0 END IF NEXT TryLetters% = TryLetters% + 1 FOR zzz% = TryLetters% TO Count% FindLetr$ = LEFT$(M$(zzz%), 1) IF ASC(FindLetr$) = Hit% THEN Start% = zzz% TryLetters% = zzz% ItemNum% = Start% ColumnPointer% = 0 show% = 0 CurrentCol% = 0 IF zzz% = Count% THEN ItemNum% = Count% TryLetters% = 0 END IF GOTO subtop END IF IF zzz% = Count% THEN zzz% = 0 END IF NEXT ELSEIF Hit% > 15103 AND Hit% < 17409 THEN 'F1 - F10 IdentKey$ = STR$(((Hit% - 15104) \ 256) + 1) IdentKey$ = LTRIM$(RTRIM$(IdentKey$)) IF IdentKey$ = "10" THEN IdentKey$ = "0" END IF IF INSTR(FKey$, IdentKey$) > 0 THEN IF IdentKey$ = "0" THEN ExitCode% = 10 EXIT SUB ELSE ExitCode% = VAL(IdentKey$) EXIT SUB END IF END IF END IF LOCATE CurrentRow%, CurrentCol%, 0, 0, 0 COLOR HiLiteFG%, HiLiteBG% PRINT M$(ItemNum%); LOOP END SUB SUB SaveRestScrn (ReadLine$(), ReadColr%(), SR.UL.Row%, SR.UL.Col%, SR.LR.Row%, SR.LR.Col%, SaveOrRest%) '+----------------------------------------------------------------------+ '| SUB written by Don Smith on 03/25/02 - Public Domain FreeWare. | '| No need to name Don as the author. EMail: smithdonb@earthlink.net | '+----------------------------------------------------------------------+ '+----------------------------------------------------------------------+ '| PLACE NUMBERS 1 AND 2 IN MAIN PROGRAM. See line number 313 in main | '| module. Also, refer to numbers 7, 8 and 9 below. | '+------------------+---------------------------------------------------|+ '| (1) ReadLine$() | Program self reads data at each Row and Column | '+------------------+---------------------------------------------------+ '| (2) ReadColr%() | Program self reads color at each Row and Column | '+------------------+---------------------------------------------------+ '+----------------------------------------------------------------------+ '| THE PROGRAMMER MUST SET NUMBERS 3 TO 9 BEFORE CALLING THIS SUB -> | '+----------------------------------------------------------------------+ '| (Note: The "SR" below means "Save" Or "Restore") | '+------------------+---------------------------------------------------+ '| (3) SR.UL.Row% | Screen to save or restore at upper left row. | '| (4) SR.UL.Col% | Screen to save or restore at upper left column. | '| (5) SR.LR.Row% | Screen to save or restore at lower right row. | '| (6) SR.LR.Col% | Screen to save or restore at lower right column.| '| +---------------------------------------------------+ '| | SPECIAL CAUTION: | '| | --------------- | '| | When you call the SUB to restore the underlying | '| | screen, use MUST use the same row and column | '| | numbers as you used when you first called the | '| | SUB to save the screen. | '+------------------+---------------------------------------------------+ '| (7) SaveOrRest% | SaveOrRest% = 1 (1 means save the screen) | '| | SaveOrRest% = 2 (2 means restore the screen) | '+------------------+----------+----------------------------------------+ '| (8) REDIM ReadLine$(25) | The REDIM for ReadLine$ and ReadColr% | '| REDIM ReadColr%(25, 80) | must be placed in the main program | '| | before calling the SUB. The 25 and 80 | '| | reflects a screen of 25 lines and 80 | '| | columns. You may use smaller amounts | '| | of memory if you do not need all 25 | '| | lines and 80 columns. | '+-----------------------------+----------------------------------------+ '| (9) ERASE ReadLine$ | Reclaim memory after calling the SUB | '| ERASE ReadColr% | to restore the screen. Use REDIM and | '| | ERASE in main program please! | '+-----------------------------+----------------------------------------+ IF SR.LR.Col% > 80 THEN SR.LR.Col% = 80 END IF IF SR.LR.Row% > 25 THEN SR.LR.Row% = 25 END IF IF SaveOrRest% = 1 THEN GOSUB save.da.screen ELSEIF SaveOrRest% = 2 THEN GOSUB restore.da.screen END IF EXIT SUB save.da.screen: FOR ViewIt% = SR.UL.Row% TO SR.LR.Row% FOR Horizon% = SR.UL.Col% TO SR.LR.Col% ReadLine$(ViewIt%) = ReadLine$(ViewIt%) + CHR$(SCREEN(ViewIt%, Horizon%)) ReadColr%(ViewIt%, Horizon%) = SCREEN(ViewIt%, Horizon%, 1) NEXT NEXT RETURN restore.da.screen: FOR FindRow% = SR.UL.Row% TO SR.LR.Row% FOR ScrnCol% = SR.UL.Col% TO SR.LR.Col% LOCATE FindRow%, ScrnCol%, 0, 0, 0 OneColr% = ReadColr%(FindRow%, ScrnCol%) FGScrnColr% = OneColr% MOD 16 BGScrnColr% = OneColr% \ 16 COLOR FGScrnColr%, BGScrnColr% PRINT MID$(ReadLine$(FindRow%), ScrnCol% - (SR.UL.Col% - 1)); NEXT NEXT RETURN END SUB SUB TrueView (FileName$, ULRow%, ULCol%, LRRow%, LRCol%, FGColr%, BGColr%, TBColrFG%, TBColrBG%, TBNumColrFG%, TBNumColrBG%, EOFColrFG%, EOFColrBG%) ' +----------------------------------------------------------------------+ ' | | ' | ð T R U E V I E W F I L E B R O W S E R ð | ' | - - - - - - - - - - - - - - - - - - - | ' | (This SUB can be very easily made into a stand alone program.) | ' +----------------------------------------------------------------------+ ' +----------------------------------------------------------------------+ ' | TrueView.Bas written by Don Smith on 05/20/2002. Written for | ' | QuickBASIC 4.5. No special libraries are needed. Released to | ' | the public domain. Programmers need not give my name. They can | ' | even change the name of the program. | ' | | ' | If this is to be made into a stand alone program, programmers | ' | will probably want to include an error screen using: | ' | ON ERROR GOTO errorhandler | ' |----------------------------------------------------------------------| ' | Information about the author: | ' | ---------------------------- | ' | Hello, my name is Don Smith and I am a retired Math/History/Spanish | ' | teacher currently residing in Orange County, California. | ' | | ' | My email is: smithdonb@earthlink.net | ' |----------------------------------------------------------------------| ' | TrueView is an ASCII text browser. TrueView is so written as to | ' | avoid having to rely on Dimensioning or Redimensioning. It | ' | continuously keeps track of where the top line is, and it | ' | continuously opens and closes the COMMAND$ file. There is never | ' | a need to worry about how much memory is needed. | ' |----------------------------------------------------------------------| ' | If is pressed, the screen is saved and moved up | ' | or down and only one line is brought in to complete the screen. | ' | and work also to move text up or down. If | ' | is pressed then the next screen page is presented. | ' |----------------------------------------------------------------------| ' | Trueview probably shouldn't be used for huge files longer than | ' | 10000 lines. Beyond 10000 lines, it slows down a tad. I have a | ' | Pentium 4 2.65 CPU Ghz Gateway computer running under WindowsXP, | ' | and Trueview really did not lag in reading a 10,000 line file. I | ' | tried it out, however, on my old Pentium-S 166 Mhz computer, and | ' | it did lag a tiny bit, but not badly. ' |----------------------------------------------------------------------| ' | Compiling: | ' | | ' | BC: TrueView /e 'use /e for errors | ' | | ' | LINK: TrueView /noe | ' | LIB : BCom45 | ' | | ' +----------------------------------------------------------------------+ ' +---------------+------------------------------------------------------+ ' | FileName$ | The ASCII text file to view. As a stand alone | ' | | program, FileName$ will be a give as a command | ' | | line parameter and will look like this at the top | ' | | of the program: FileName$ = COMMAND$ | ' |---------------+------------------------------------------------------| ' | ULRow% | Upper left row to place text. | ' |---------------+------------------------------------------------------| ' | ULCol% | Upper left column to place text. | ' |---------------+------------------------------------------------------| ' | LRRow% | Lower right row to place text. | ' |---------------+------------------------------------------------------| ' | LRCol% | Lower right column to place text. | ' |---------------+------------------------------------------------------| ' | FGColr% | Foreground color of text (0-15). | ' |---------------+------------------------------------------------------| ' | BGColr% | Back ground color of text (0-7). | ' |---------------+------------------------------------------------------| ' | TBColrFG% | Foreground color of top/bottom strips (0-15). | ' |---------------+------------------------------------------------------| ' | TBColrBG% | Background color of the top/bottom strips (0-7). | ' |---------------+------------------------------------------------------| ' | TBNumColrFG% | Foreground color of top line numbering (0-15). | ' |---------------+------------------------------------------------------| ' | TBNumColrBG% | Background color of bottom line numbering (0-7). | ' |---------------+------------------------------------------------------| ' | EOFColrFG% | Foreground color of "End Of File" message (0-15). | ' |---------------+------------------------------------------------------| ' | EOFColrBG% | Background color of "End Of File" message (0-7). | ' +---------------+------------------------------------------------------+ FileName$ = RTRIM$(LTRIM$(FileName$)) SR.UL.Row% = ULRow% 'Upper left row to save/restore screen. SR.UL.Col% = ULCol% 'Upper left column to save/restore screen SR.LR.Row% = LRRow% 'Lower right row to save/restore screen. SR.LR.Col% = LRCol% 'Lower right column to save/restore screen. ' Temp.UL.Row% = SR.UL.Row% + 1 Temp.LR.Row% = SR.LR.Row% - 1 DownUp& = 1 ' 'next 9 lines set up the beginning screen and then closes OpeningScreen% = LRRow% - ULRow% + 1 OPEN FileName$ FOR INPUT AS #1 COLOR FGColr%, BGColr%: CLS FOR BringIt% = 1 TO OpeningScreen% IF EOF(1) THEN EXIT FOR LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) LOCATE BringIt% + ULRow% - 1, ULCol%, 0, 0, 0 LOCATE , , 0, 0, 0 PRINT M$; CheckLines% = CheckLines% + 1 NEXT IF CheckLines% < 23 THEN EndYes% = 1: EndPg% = 1: EndOfPage% = 1 END IF GOSUB paint.top.bottom CLOSE #1 loopdeloop: DO IF DownUp& <= 0 THEN DownUp& = 1 END IF COLOR TBNumColrFG%, TBNumColrBG% LOCATE ULRow% - 1, 71, 0, 0, 0: PRINT " "; LOCATE ULRow% - 1, 71, 0, 0, 0: PRINT STR$(DownUp&); LOCATE LRRow% + 1, 71, 0, 0, 0: PRINT " "; LOCATE LRRow% + 1, 71, 0, 0, 0: PRINT STR$(DownUp& + (LRRow% - ULRow%)); COLOR FGColr%, BGColr% DO TheKey$ = INKEY$ LOOP UNTIL LEN(TheKey$) > 0 TheKey% = CVI(TheKey$ + CHR$(0)) IF TheKey% = 20480 OR TheKey% = 19712 THEN ' IF Booboo% = 1 OR CheckLines% < 23 THEN GOTO loopdeloop ELSE EndYes% = 0: EndPg% = 0 FileEnd% = 0 END IF DnAr% = 1 UpAr% = 0 IF EndOfFile% <> 1 THEN SR.UL.Row% = Temp.UL.Row% SR.LR.Row% = Temp.LR.Row% + 1 GOSUB save.true.screen CLOSE #1 OPEN FileName$ FOR INPUT AS #1 FOR DnIt& = 1 TO DownUp& + (LRRow% - ULRow% + 1) IF EOF(1) THEN EndOfFile% = 1 EndPg% = 1 CLOSE #1 EXIT FOR END IF LINE INPUT #1, Fox$ IF RTRIM$(LTRIM$(Fox$)) = CHR$(12) THEN Fox$ = SPACE$(80) Fox$ = LEFT$(Fox$, 80) NEXT IF EndOfFile% <> 1 THEN IF NOT EOF(1) THEN LOCATE LRRow%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE LRRow%, ULCol%, 0, 0, 0 PRINT Fox$; ELSEIF EOF(1) THEN LOCATE LRRow%, ULCol%, 0, 0, 0 COLOR EOFColrFG%, EOFColrBG% SOUND 150, 2 PRINT STRING$(35, "-") + "End Of File" + STRING$(34, "-"); END IF END IF DownUp& = DownUp& + 1 ELSEIF EndOfFile% = 1 THEN GOTO loopdeloop END IF ELSEIF TheKey% = 20736 THEN ' IF EndPg% = 1 OR EndYes% = 1 OR EndOfPage% = 1 OR CheckLines% < 23 THEN GOTO loopdeloop END IF IF FileEnd% = 0 THEN CLOSE #1 FileEnd% = 1 END IF PgDn& = DownUp& + LRRow% - ULRow% CLOSE #1 OPEN FileName$ FOR INPUT AS #1 FOR PgDn1& = 1 TO PgDn& IF EOF(1) THEN FileEnd% = 1 CLOSE #1 EXIT FOR END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) NEXT DownUp& = DownUp& + (LRRow% - ULRow% + 1) FOR PgDn2% = 1 TO (LRRow% - ULRow% + 1) IF EndPg% = 0 THEN IF EOF(1) THEN FileEnd% = 1 CLOSE #1 GOSUB da.end.james EXIT FOR END IF END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE PgDn2% + 1, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE PgDn2% + 1, ULCol%, 0, 0, 0 PRINT M$; NEXT ELSEIF TheKey% = 18688 THEN ' Booboo% = 0 EndYes% = 0: EndPg% = 0 IF PgDn& > LRRow% - ULRow% + 1 OR DownUp& > (LRRow% - ULRow% + 1) THEN PgUp& = DownUp& - (LRRow% - ULRow% + 1) CLOSE #1 OPEN FileName$ FOR INPUT AS #1 FOR PgUp1& = 1 TO PgUp& - 1 LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) NEXT FOR PgUp2& = 1 TO (LRRow% - ULRow% + 1) LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE PgUp2& + 1, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE PgUp2& + 1, ULCol%, 0, 0, 0 PRINT M$; NEXT DownUp& = DownUp& - (LRRow% - ULRow% + 1) ELSE GOSUB home.james END IF ELSEIF TheKey% = 18432 OR TheKey% = 19200 THEN ' Booboo% = 0 EndYes% = 0: EndPg% = 0 EndOfFile% = 0 EndPg% = 0 FileEnd% = 0 DnAr% = 0 UpAr% = 1 DownUp& = DownUp& - 1 IF DownUp& = 1 THEN GOSUB home.james ELSEIF DownUp& > 1 THEN SR.UL.Row% = Temp.UL.Row% - 1 SR.LR.Row% = Temp.LR.Row% GOSUB save.true.screen CLOSE #1 OPEN FileName$ FOR INPUT AS #1 FOR UpIt& = 1 TO DownUp& LINE INPUT #1, M$ NEXT IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE ULRow%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE ULRow%, ULCol%, 0, 0, 0 PRINT M$; END IF ELSEIF TheKey% = 18176 THEN ' EndYes% = 0: EndPg% = 0: Booboo% = 0 GOSUB home.james ELSEIF TheKey% = 20224 THEN ' EndPg% = 0: Booboo% = 0 IF EndYes% = 0 THEN GOSUB da.end.james END IF ELSEIF TheKey% = 27 THEN CLOSE #1 EXIT SUB END IF LOOP paint.top.bottom: ' +---------------------------------------------------------------------+ ' | When this subroutine is called, the top and bottom | ' | rows are displayed. | ' +---------------------------------------------------------------------+ COLOR TBColrFG%, TBColrBG% LOCATE ULRow% - 1, 1, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE ULRow% - 1, 31, 0, 0, 0 PRINT CHR$(240) + " TrueView Program " + CHR$(240); LOCATE ULRow% - 1, 62, 0, 0, 0 PRINT "Top Line:"; LOCATE ULRow% - 1, 2, 0, 0, 0 PRINT "File: " + FileName$ LOCATE LRRow% + 1, 1, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE LRRow% + 1, 2, 0, 0, 0 PRINT "EXIT: MOVE: "; LOCATE LRRow% + 1, 21, 0, 0, 0 PRINT "<" + CHR$(24) + "> <" + CHR$(25) + "> "; LOCATE LRRow% + 1, 59, 0, 0, 0 PRINT "Bottom Line: "; COLOR FGColr%, BGColr% RETURN da.end.james: ' +---------------------------------------------------------------------+ ' | when the end of a file is reached, the | ' | program branches to this procedure: | ' +---------------------------------------------------------------------+ EndYes% = 1: EndPg% = 1 COLOR TBColrFG%, TBColrBG% LOCATE 1, 22, 0, 0, 0: PRINT "- Please Wait -" + SPACE$(14) DownUp& = 0 EndOfFile% = 0 FileEnd% = 0 CountLines& = 0 CLOSE #1 OPEN FileName$ FOR INPUT AS #1 DO LINE INPUT #1, ThrowAway$ IF EOF(1) THEN EXIT DO CountLines& = CountLines& + 1 LOOP UNTIL EOF(1) CLOSE #1 OPEN FileName$ FOR INPUT AS #1 FOR LastScrn& = 1 TO CountLines& + 1 - (LRRow% - ULRow% + 1) IF EOF(1) THEN EXIT FOR END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) ManyLines& = ManyLines& + 1 COLOR TBColrFG%, TBColrBG% LOCATE 1, 40, 0, 0, 0: PRINT "Loading:"; LOCATE 1, 49, 0, 0, 0: PRINT RTRIM$(LTRIM$(STR$(ManyLines&))); NEXT GOSUB paint.top.bottom FOR TheLastScrn% = ULRow% TO LRRow% IF EOF(1) THEN EXIT FOR END IF LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) COLOR FGColr%, BGColr% LOCATE TheLastScrn%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LOCATE TheLastScrn%, ULCol%, 0, 0, 0 PRINT M$; NEXT CLOSE #1 DownUp& = CountLines& - (LRRow% - ULRow% + 1) + 1 COLOR TBColrFG%, TBColrBG% LOCATE 1, 22, 0, 0, 0: PRINT " - TrueView Program - "; COLOR FGColr%, BGColr% ManyLines& = 0 RETURN home.james: ' +---------------------------------------------------------------------+ ' | when the top of a file is reached, the program | ' | branches to this subroutine: | ' +---------------------------------------------------------------------+ CLOSE #1 OPEN FileName$ FOR INPUT AS #1 FOR HomePage% = ULRow% TO LRRow% IF EOF(1) THEN EXIT FOR END IF LOCATE HomePage%, ULCol%, 0, 0, 0 PRINT SPACE$(LRCol% - ULCol% + 1); LINE INPUT #1, M$ IF RTRIM$(LTRIM$(M$)) = CHR$(12) THEN M$ = SPACE$(80) M$ = LEFT$(M$, 80) LOCATE HomePage%, ULCol%, 0, 0, 0 PRINT M$; NEXT DownUp& = 1 GOSUB paint.top.bottom RETURN save.true.screen: ' +---------------------------------------------------------------------+ ' | When the program asks for GOSUB save.screen, the following | ' | six lines saves the screen from row 2 to row 24: | ' +---------------------------------------------------------------------+ REDIM ReadLine$(25) FOR ViewIt% = SR.UL.Row% TO SR.LR.Row% FOR Horizon% = SR.UL.Col% TO SR.LR.Col% ReadLine$(ViewIt%) = ReadLine$(ViewIt%) + CHR$(SCREEN(ViewIt%, Horizon%)) NEXT NEXT restore.true.screen: ' +---------------------------------------------------------------------+ ' |This subroutine restores the above saved screen, except the saved | ' |screen is moved either up or down. If the down arrow is pressed, then| ' |DnAr% = 1 and the saved screen is moved up one place and a new line | ' |is brought in and displayed at row 24. If the up arrow is pressed, | ' |then UpAr% = 1 and the saved screen is moved down one row and a new | ' |line is displayed at row 2, just under the top linebar. | ' +---------------------------------------------------------------------+ IF DnAr% = 1 THEN StartSite% = SR.UL.Row% - 1 StopSite% = SR.LR.Row% - 1 ELSEIF UpAr% = 1 THEN StartSite% = SR.UL.Row% + 1 StopSite% = SR.LR.Row% + 1 END IF FOR FindRow% = StartSite% TO StopSite% LOCATE FindRow%, SR.UL.Col%, 0, 0, 0 PRINT SPACE$(LRRow% - ULRow% + 1); LOCATE FindRow%, SR.UL.Col%, 0, 0, 0 COLOR FGColr%, BGColr% IF DnAr% = 1 THEN PRINT ReadLine$(FindRow% + DnAr%); ELSEIF UpAr% = 1 THEN PRINT ReadLine$(FindRow% - UpAr%); END IF NEXT ERASE ReadLine$ RETURN END SUB