home *** CD-ROM | disk | FTP | other *** search
- DECLARE SUB nodatafile ()
- DECLARE SUB dialogtwo (dialog$(), first$, lenfirst%, second$, lensecond%)
- DECLARE SUB buildscreen ()
- DECLARE SUB clearscreen ()
- DECLARE SUB createdatafile ()
- DECLARE SUB DispRecField (temp AS ANY)
- DECLARE SUB initindex ()
- DECLARE SUB RecFieldselect (indexnum%, key$, MastRec%, IndexRec%, exitcode%)
- DECLARE SUB seldatafile ()
- DECLARE SUB mainscreen ()
- DECLARE SUB nodata ()
- DECLARE FUNCTION strval$ (a%)
- DECLARE SUB PIM (cmd$, indexnum%, key$, MastRec%, CurrentIndexREC%)
- DECLARE SUB PIMClose (indexnum%, file$)
- DECLARE SUB PIMCreate (indexnum%, file$, keylength%, mfile$)
- DECLARE SUB PIMdelkey (IxNum%, temp$, MastRec%, IndexRec%)
- DECLARE SUB PIMOpen (indexnum%, file$)
- DECLARE SUB formatinfo ()
- DECLARE SUB proginfo1 ()
- DECLARE SUB proginfo2 ()
- DECLARE SUB PROBRO.1 ()
- DECLARE FUNCTION PIMstats% (indexnum%)
-
- DEFINT A-Z
-
- ' Microsoft BASIC 7.1, Professional Development System
- ' Copyright (C) 1987-1989, Microsoft Corporation
- '
- ' Microsoft QBX 7.1, Professional Development System
- ' Copyright (C) 1987-1989, Microsoft Corporation
- '
- ' PROSCN71.bas, PROSCN71.qlb and source are Copyrighted (c)
- ' 1991 by: Raymond E Dixon
- '
- ' Raymond E Dixon
- ' 11660 VC JOHNSON RD.
- ' Jacksonville, Fl. 32218
- '
- ' (904) 765-4048
- TYPE RecordType
- status AS STRING * 1 'First element is in use flag
- Num AS STRING * 3
- name AS STRING * 16 '(in order for alphabetical sort)
- type AS STRING * 1
- case AS STRING * 1
- key AS STRING * 1
- decimal AS STRING * 2
- length AS STRING * 2
- format AS STRING * 50
- erow AS STRING * 2
- ecol AS STRING * 2
- progname AS STRING * 8
- comment AS STRING * 30
- recnum AS INTEGER
- DUM AS STRING * 14
- END TYPE
-
- COMMON SHARED MASTERFILE$, numberoffields, ff, progfile$, startp
- OPTION BASE 0
-
- ' $INCLUDE: 'PROLIB71.BI'
- STACK 4000
- '$DYNAMIC
- DIM SHARED scrnline$(25) ' Lines 1-24
- DIM SHARED RecField AS RecordType
- DIM SHARED formatsel1$(16)
- DIM SHARED formatsel2$(16)
- DIM SHARED fieldpointer%(26, 81) ' Field input markers
- DIM SHARED fieldpos%(50, 10, 2) ' Field pos markers
- DIM SHARED fl$(70)
- DIM SHARED dialog$(20)
- DIM SHARED omenu$(10)
- DIM SHARED TestRecField AS RecordType
- DIM SHARED DispLine$(30)
- DIM SHARED Findex(50) AS RecordType
-
- fg = WHITE
- bg = BLUE
- rev = RED
-
- LOCATE 25, 1, 0, 0, 0
- COLOR WHITE, BLUE
-
- CONST RecFieldNameIDX = 1
- CONST RecFieldNumIDX = 2
- CONST datfile = 3
- REDO:
- mainscreen
- MsgLine "Press " + CHR$(24) + " for last " + CHR$(25) + " for next ENTER to select", 25, 0, 7
-
- DrawBox 21, 22, 40, 3, 2, BLACK, WHITE, 1, BLACK, WHITE, 1
- CenterText "Select Program Database", 22, BLACK, WHITE
-
-
- fl$ = "SAMPLE PROGRAM\"
- fl$ = fl$ + "USER PROGRAM\"
- fl$ = fl$ + "NEW PROGRAM\"
-
- Dopt = MenuWindow(0, 0, fl$, "SELECT ", BLACK, WHITE, RED, 0)
-
- 'Get the option
-
- SELECT CASE Dopt 'Select on choice
- CASE 1
- MASTERFILE$ = "SAMPLE.FLD"
- CASE 2
- seldatafile
- CASE 3
- CLOSE
- RUN "progen71"
- CASE ELSE
- END SELECT
-
- IF MASTERFILE$ = "" THEN
- GOTO REDO
- END IF
-
- NEWFILE:
-
- IF FileExists(MASTERFILE$) = 0 THEN 'If no index then create
- GOTO REDO
-
- ELSE
-
- PIMOpen RecFieldNameIDX, MASTERFILE$ 'Open Index
- PIMOpen RecFieldNumIDX, MASTERFILE$ 'Open Index
-
- OPEN MASTERFILE$ FOR RANDOM AS datfile LEN = LEN(RecField) 'Open the data file
-
- initindex
- delimit = INSTR(MASTERFILE$, ".")
-
- IF delimit THEN
- RecField.progname = LEFT$(MASTERFILE$, delimit - 1)
- ELSE
- RecField.progname = MASTERFILE$
- END IF
- progfile$ = LEFT$(MASTERFILE$, delimit - 1)
- DO
- CALL buildscreen
- EXIT DO
- LOOP
- CLOSE
- GOTO REDO
- END IF
- END
-
- REM $STATIC
- SUB buildscreen
-
- fg% = WHITE
- bg% = BLUE
- rev% = RED
- FrmFG = BLACK
- FrmBG = WHITE
- GenFG = BLACK
- GenBG = WHITE
- DispPos = 1
- LOCATE , , 0
- CLS
- DrawBox 1, 1, 80, 25, 0, WHITE, BLUE, 1, WHITE, BLUE, 0
-
- fgm% = WHITE
- bgm% = BLACK
- clearscreen
- ins$ = "Off"
- x% = 1
- y% = 1
- xmin% = 1
- xmax% = 80
- ymin% = 1
- ymax% = 25
-
- lup% = 0
- lsch% = 32 ' Last special alternate character
- editmode% = 0 ' Currently in NODRAW mode
-
- WHILE lup% = 0
-
- IF fieldpointer%(y%, x%) THEN
- modemsg$ = "F3 = Disp Info :"
- fieldset% = 1
- ELSE
- modemsg$ = " "
- fieldset% = 0
- END IF
-
- IF editmode% = 1 THEN
- modemsg$ = "Draw "
- IF drawvertlin% = 1 THEN
- modemsg$ = modemsg$ + "Vert Line"
- END IF
- IF drawhorzlin% = 1 THEN
- modemsg$ = modemsg$ + "Horz Line"
- END IF
- IF drawboxlin% = 1 THEN
- modemsg$ = modemsg$ + "Box "
- END IF
- END IF
-
- menop% = 0
- menu% = 0
-
- IF fieldset% THEN
-
- fp% = fieldpointer%(y%, x%)
- IF fp% THEN
- GET #datfile, fp%, RecField
- fid$ = RecField.name
- END IF
- ELSE
- fid$ = " "
- END IF
-
- optex1$ = " ESC = cmds Ins=" + ins$ + " " + modemsg$ + fid$
- optex2$ = "Col = " + strval$(x%) + " "
- optex3$ = "Row = " + strval$(y%) + " "
-
- CALL pnc(STRING$(80, " "), 25, 1, BLACK, WHITE)
- CALL pnc(optex1$, 25, 1, BLACK, WHITE)
- CALL pnc(optex3$, 25, 58, BLACK, WHITE)
- CALL pnc(optex2$, 25, 69, BLACK, WHITE)
-
- LOCATE y%, x%, 1, 0, 15 ' Display the cursor
-
- CALL GetSingle(ch%, ctype%)
-
- SELECT CASE ctype%
- CASE 1
-
- SELECT CASE ch%
-
- CASE 27 ' Repeat last Alternate Character
-
- LOCATE , , 0, 0
- dialog$(1) = "Function Key Commands"
- dialog$(2) = ""
- dialog$(3) = "F1 = COMMAND Menu " + CHR$(255)
- dialog$(4) = "F2 = Insert Field " + CHR$(255)
- dialog$(5) = "F3 = Display Field Info " + CHR$(255)
- dialog$(6) = "F4 = Delete Field Info " + CHR$(255)
- dialog$(7) = "F5 = Insert Special Field" + CHR$(255)
- dialog$(8) = "F6 = Display Special Field" + CHR$(255)
- dialog$(9) = "F7 = Delete Special Field" + CHR$(255)
- dialog$(10) = "F8 = Select ASC Char " + CHR$(255)
- dialog$(11) = "F9 = Print ASC Char " + CHR$(255)
- dialog$(12) = ""
- dialog$(13) = "any key to return"
-
- CALL Message(dialog$(), 13, 2, FrmFG, FrmBG, GenFG, GenBG)
-
- END SELECT
-
- CASE 2
-
- SELECT CASE ch%
-
- CASE 59
- LOCATE , , 0
- DO
- menu$ = "1 - File\2 - Edit\3 - Draw\4 - Color Setup\5 - Exit\"
-
- omenu$(1) = "1 - Load\2 - Save\3 - Change Progran\4 - Gen Sub\5 - Default Screen\"
- omenu$(2) = "1 - Copy of above line\2 - Center Line\3 - Insert Blank Line\4 - Delete Line\5 - Insert Column\6 - Delete Column\7 - Find & Replace\8 - Clear\"
- omenu$(3) = "1 - Box\2 - Vertical Line\3 - Horizontal Line\"
- omenu$(5) = "1 - To Editor\2 - To PROGEN\3 - To PRORPT\4 - To DOS"
- omenu$(4) = "1 - Define Attributes\"
-
- menu% = MenuWindow%(row%, col%, menu$, "Main Menu", BLACK, WHITE%, RED, 0)
- menop% = MenuWindow%(row%, col%, omenu$(menu%), "Menu", BLACK, WHITE%, RED, 1)
-
- LOOP WHILE menop% = 0
- prvmen% = menu%
- prvop% = menop%
-
- SELECT CASE menu%
- CASE 1
- SELECT CASE menop%
- CASE 1 ' Load a file
- clearscreen
-
- OPT$ = "*.SCR"
- OPT$ = SelFiles(OPT$)
- ff = FREEFILE
- IF LEN(OPT$) THEN
- TEST$ = LEFT$(OPT$, INSTR(OPT$, ".") - 1)
-
- IF FileExists(TEST$ + ".fld") <> 0 THEN 'If no index then create
-
- OPEN "r", ff, OPT$, 80
- OPT$ = LEFT$(OPT$, INSTR(OPT$, ".") - 1)
- FIELD #ff, 80 AS s1$
- FOR j% = 1 TO 25
- GET #ff, j%
- scrnline$(j%) = s1$
- NEXT j%
- GET #ff, 26
- Trim s1$
- MASTERFILE$ = s1$
- CLOSE ff
- IF LEN(MASTERFILE$) THEN
- CLOSE datfile
- OPEN MASTERFILE$ FOR RANDOM AS datfile LEN = LEN(RecField) 'Open the data file
- END IF
- initindex
-
- ELSE
- CALL nodatafile
- END IF
- END IF
- FOR j% = 1 TO 25
- pnc scrnline$(j%), j%, 1, fg%, bg%
- NEXT j%
-
- CASE 2 ' Save a file
-
- LOCATE , , 0, 0
- dialog$(1) = "Save this Screen as ..."
- dialog$(2) = ""
- fil1$ = progfile$
- l1% = 8
- CALL DialogBox(dialog$(), 2, 0, l1%, FrmFG, FrmBG, GenFG, GenBG, DispPos, fil1$, "########", Ek)
- CALL Trim(fil1$)
- IF LEN(fil.1$) THEN
- ffs = FREEFILE
- OPEN "r", ffs, fil.1$ + ".SCR", 80
- FIELD #ffs, 80 AS s1$
- FOR j% = 1 TO 25
- LSET s1$ = scrnline$(j%)
- PUT #ffs, j%
- NEXT j%
- LSET s1$ = MASTERFILE$
- PUT #ffs, 26
- CLOSE ff
-
- END IF
-
- CASE 3 ' change program
- EXIT SUB
-
- CASE 4 ' Generate screen
- LOCATE , , 0, 0
- dialog$(1) = "Screen sub to create is ..."
- dialog$(2) = ""
- fil.1$ = STRING$(8, 32)
- l1% = 8
-
- CALL DialogBox(dialog$(), 2, 0, l1%, FrmFG, FrmBG, GenFG, GenBG, DispPos, fil.1$, "########", Ek)
- ffg = FREEFILE
- CALL Trim(fil.1$)
- OPEN "o", ffg, fil.1$ + ".bas"
- LOCATE , , 0, 0
- dialog$(1) = "Title this program ..."
- dialog$(2) = ""
- format$ = STRING$(50, "#")
- CALL DialogBox(dialog$(), 2, 0, 50, FrmFG, FrmBG, GenFG, GenBG, DispPos, tit$, format$, Ek)
-
- CALL Trim(tit$)
- PRINT #ffg, " sub " + fil.1$ + ".frame static"
-
- FOR j% = 1 TO 25
- w$ = scrnline$(j%)
- CALL Trim(w$)
- IF LEN(w$) THEN
- w% = INSTR(scrnline$(j%), w$)
- PRINT #ffg, " pnc " + CHR$(34) + w$ + CHR$(34) + "," + strval$(j%) + "," + strval$(w%) + ",fg,bg"
- END IF
- NEXT j%
- PRINT #ffg, " end sub ' " + fil.1$
- CLOSE ffg
-
- CASE 5 ' DEFAULT SCREEN
-
- clearscreen
- initindex
- startp = 12 - (numberoffields \ 2)
-
- FOR j% = 1 TO numberoffields
-
- w$ = Findex(j%).name
- F$ = Findex(j%).ecol
- T$ = Findex(j%).erow
- d$ = w$ + ":"
-
- CALL Trim(w$)
- CALL Trim(F$)
- CALL Trim(T$)
-
- IF LEN(w$) THEN
-
- scrnline$(startp + j%) = STRING$(80, " ")
-
- MID$(scrnline$(startp + j%), 4, 18) = d$
- MID$(scrnline$(startp + j%), 22, LEN(RTRIM$(Findex(j%).format))) = STRING$(LEN(RTRIM$(Findex(j%).format)), CHR$(219))
- fl$ = Findex(j%).format
- Trim fl$
-
- FOR fp% = 22 TO 22 + LEN(fl$) - 1
- fieldpointer%(startp + j%, fp%) = Findex(j%).recnum
- NEXT
-
- Findex(j%).erow = strval$(startp + j%)
- Findex(j%).ecol = strval$(22)
-
- PUT #datfile, Findex(j%).recnum, Findex(j%)
-
- END IF
- NEXT j%
-
- filespec$ = MASTERFILE$
- delimit = INSTR(filespec$, ".")
-
- IF delimit THEN
- FileName$ = LEFT$(filespec$, delimit - 1)
- fileext$ = RIGHT$(filespec$, LEN(filespec$) - (delimit))
- ELSE
- FileName$ = filespec$
- fileext$ = ".BAS"
- END IF
-
- fil.1$ = FileName$
-
- CALL Trim(fil.1$)
-
- IF LEN(fil.1$) THEN
- ffd = FREEFILE
- OPEN "r", ffd, fil.1$ + ".SCR", 80
- FIELD #ffd, 80 AS s1$
- FOR j% = 1 TO 25
-
- LSET s1$ = scrnline$(j%)
- PUT #ffd, j%
-
- NEXT j%
- CLOSE ffd
-
- FOR j% = 1 TO 25
- pnc scrnline$(j%), j%, 1, fg%, bg%
- NEXT j%
- END IF
-
- END SELECT 'menu option 1
-
- CASE 2
-
- SELECT CASE menop%
-
- CASE 1 ' Copy above line
-
- scrnline$(y%) = scrnline$(y% - 1)
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
- y% = y% + 1
-
- CASE 2 ' Centre line
-
- CALL Trim(scrnline$(y%))
- scrnline$(y%) = STRING$((80 - LEN(scrnline$(y%))) / 2, 32) + scrnline$(y%)
- scrnline$(y%) = scrnline$(y%) + STRING$(80 - LEN(scrnline$(y%)), 32)
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
-
- CASE 3 ' Insert line
-
- FOR j% = 25 TO y% + 1 STEP -1
- scrnline$(j%) = scrnline$(j% - 1)
- NEXT j%
- scrnline$(y%) = STRING$(80, 32)
- FOR j% = 25 TO y% STEP -1
- CALL pnc(scrnline$(j%), j%, 1, fg%, bg%)
- NEXT j%
-
- CASE 4 ' Delete line
-
- FOR j% = y% TO 23
- scrnline$(j%) = scrnline$(j% + 1)
- NEXT j%
- scrnline$(25) = STRING$(80, 32)
- FOR j% = y% TO 25
- CALL pnc(scrnline$(j%), j%, 1, fg%, bg%)
- NEXT j%
-
- FOR j% = y% TO 23
- FOR k% = 1 TO 80
- fieldpointer%(j%, k%) = fieldpointer%(j% + 1, k%)
- NEXT k%
- NEXT j%
-
- FOR k% = 1 TO 80
- fieldpointer%(j% + 1, k%) = 0
- fieldpointer%(25, k%) = 0
- NEXT k%
- GOSUB updateREC
-
- CASE 5 ' Insert column
-
- ch% = 32 ' Character to insert
- xs% = x% - 1
-
- FOR j% = 1 TO 25
-
- IF x% = 1 THEN
- scrnline$(j%) = CHR$(ch%) + MID$(scrnline$(j%), 1, 79)
- ELSEIF x% = 80 THEN
- MID$(scrnline$(j%), 80, 1) = CHR$(ch%)
- ELSEIF (x% > 1 AND x% < 80) THEN
- pref$ = MID$(scrnline$(j%), 1, x% - 1)
- post$ = MID$(scrnline$(j%), x%, 79)
- scrnline$(j%) = pref$ + CHR$(ch%) + post$
- END IF
-
- IF LEN(scrnline$(j%)) > 80 THEN
- scrnline$(j%) = MID$(scrnline$(j%), 1, 80)
- END IF
-
- CALL pnc(scrnline$(j%), j%, 1, fg%, bg%)
-
- NEXT j%
-
- FOR j% = 1 TO 25
- IF INSTR(1, scrnline$(j%), CHR$(219)) THEN
- FOR k% = 79 TO xs% STEP -1
- SWAP fieldpointer%(j%, k%), fieldpointer%(j%, k% + 1)
- NEXT k%
- GOSUB updateREC
- END IF
- NEXT j%
-
- CASE 6 ' Delete column
-
- FOR j% = 1 TO 25
-
- IF x% = 1 THEN
- scrnline$(j%) = MID$(scrnline$(j%), 2, 80) + " "
- ELSEIF x% = 80 THEN
- MID$(scrnline$(j%), 80, 1) = " "
- ELSEIF (x% > 1 AND x% < 80) THEN
- pref$ = MID$(scrnline$(j%), 1, x% - 1)
- post$ = MID$(scrnline$(j%), x% + 1, 79)
- scrnline$(j%) = pref$ + post$ + " "
- END IF
-
- CALL pnc(scrnline$(j%), j%, 1, fg%, bg%)
- NEXT j%
-
- FOR j% = 1 TO 25
- IF INSTR(1, scrnline$(j%), CHR$(219)) THEN
-
- FOR k% = x% TO 79
- SWAP fieldpointer%(j%, k%), fieldpointer%(j%, k% + 1)
- NEXT k%
- GOSUB updateREC
- END IF
- NEXT j%
-
- FOR k% = 1 TO 25
- fieldpointer%(k%, 80) = 0
- NEXT k%
-
- CASE 7 ' Find & Replace
-
- LOCATE , , 0, 0
- dialog$(1) = "Find..."
- dialog$(2) = "and replace it with..."
- 'dialog$(3) = "If items differ in length, the"
- 'dialog$(4) = "line will loose characters)"
- find$ = STRING$(8, 32)
- rep$ = STRING$(8, 32)
- l1% = 8
- l2% = 8
-
- CALL dialogtwo(dialog$(), find$, l1%, rep$, l2%)
-
- Trim (find$)
- Trim (rep$)
-
- a% = LEN(find$)
- b% = LEN(rep$)
- IF a% > b% THEN
- b% = a%
- END IF
-
- IF LEN(find$) < b% THEN
- find$ = find$ + STRING$(b% - LEN(find$), 32)
- END IF
-
- IF LEN(rep$) < b% THEN
- rep$ = rep$ + STRING$(b% - LEN(rep$), 32)
- END IF
-
- FOR j% = 1 TO 25
- a% = INSTR(scrnline$(j%), find$)
- c% = 0
- WHILE a% AND c% < 80
- MID$(scrnline$(j%), a%, b%) = rep$
- c% = c% + 1
- a% = INSTR(scrnline$(j%), find$)
- WEND
- CALL pnc(scrnline$(j%), j%, 1, fg%, bg%)
-
- NEXT j%
-
- CASE 8 ' CLEAR
-
- FOR j% = 1 TO 25
- scrnline$(j%) = STRING$(80, 32)
- CALL pnc(scrnline$(j%), j%, 1, fg%, bg%)
- FOR k% = 1 TO 80
- fieldpointer%(j%, k%) = 0
- NEXT k%
- NEXT j%
-
- END SELECT 'menu option 2
-
- CASE 3 'menu 3
-
- SELECT CASE menop%
-
- CASE 1 ' Draw a BOX
- LOCATE , , 0, 0
- dialog$(1) = "To draw a box, move to the opposite"
- dialog$(2) = "corner and press return, continue?"
- yn$ = "YyNn"
- Ques$ = "Y/N"
-
- CALL AskQuestion(dialog$(), 2, 2, 1, FrmFG, FrmBG, GenFG, GenBG, Ques$, yn$)
-
- IF yn$ = "Y" THEN ' Yes, a box has been chosen
- drawboxlin% = 1 ' Turn on box draw
- editmode% = 1 ' Make allowable input draw only
- crx% = x%
- cry% = y%
- END IF
-
- CASE 2 ' Draw a Vertical line
-
- LOCATE , , 0, 0
- dialog$(1) = "To draw a line, move to the opposite"
- dialog$(2) = "end and press return, continue?"
- Ques$ = "Y/N"
- yn$ = "YyNn"
-
- CALL AskQuestion(dialog$(), 2, 2, 1, FrmFG, FrmBG, GenFG, GenBG, Ques$, yn$)
-
- IF yn$ = "Y" THEN ' Yes, a vertical line has been chosen
- drawvertlin% = 1 ' Turn on line draw
- editmode% = 1 ' Make allowable input draw only
- crx% = x%
- cry% = y%
- END IF
-
- CASE 3 ' Draw a horizontal line
-
- LOCATE , , 0, 0
- dialog$(1) = "To draw a line, move to the opposite"
- dialog$(2) = "end and press return, continue?"
- Ques$ = "Y/N"
- yn$ = "YyNn"
-
- CALL AskQuestion(dialog$(), 2, 2, 1, FrmFG, FrmBG, GenFG, GenBG, Ques$, yn$)
- IF yn$ = "Y" THEN ' Yes, a horizontal line been chosen
- drawhorzlin% = 1 ' Turn on line draw
- editmode% = 1 ' Make allowable input draw only
- crx% = x%
- cry% = y%
- END IF
- END SELECT 'menu option 3
-
- CASE 4 'menu 4 set color
-
- CALL GetBackground(1, 1, 25, 80, temp$)
- CLS
- CALL PutBackground(1, 1, temp$)
- trmp$ = ""
- menop% = 0
- menu% = 0
-
- CASE 5
-
- SELECT CASE menop%
-
- CASE 2 'generate basic program
-
- LOCATE , , 0, 0
- dialog$(1) = "Have you SAVE'd your screen"
- dialog$(2) = "Do you still want to exit SCRGEN ?"
- Ques$ = "(Y/N)"
- yn$ = "YyNn"
-
- CALL AskQuestion(dialog$(), 2, 2, 1, BLACK, WHITE, BLACK, WHITE, Ques$, yn$)
-
- IF yn$ = "Y" THEN
- CHAIN "progen71"
- END IF
-
- CASE 3 'generate screens
-
- LOCATE , , 0, 0
- dialog$(1) = "Have you SAVE'd your screen"
- dialog$(2) = "Do you still want to exit SCRGEN ?"
- Ques$ = "(Y/N)"
- yn$ = "YyNn"
-
- CALL AskQuestion(dialog$(), 2, 2, 1, BLACK, WHITE, BLACK, WHITE, Ques$, yn$)
-
- IF yn$ = "Y" THEN 'generate screens
- CHAIN "prorpt71"
- END IF
-
- CASE 4 'generate screens
-
- LOCATE , , 0, 0
- dialog$(1) = "Have you SAVE'd your screen"
- dialog$(2) = "Do you still want to exit SCRGEN ?"
- Ques$ = "(Y/N)"
- yn$ = "YyNn"
-
- CALL AskQuestion(dialog$(), 2, 2, 1, BLACK, WHITE, BLACK, WHITE, Ques$, yn$)
-
- IF yn$ = "Y" THEN 'generate screens
- CLOSE
- END
- END IF
-
- END SELECT
- END SELECT
-
- CASE 60 'F2 insert field info
-
- initindex
-
- DO
- LOCATE , , 0, 0
- RecFieldselect RecFieldNumIDX, key$, curmasrec, IndexRec, exitcode
-
- IF exitcode = 0 THEN
- nodata
- EXIT DO
- END IF
-
- IF exitcode = 1 THEN
- EXIT DO
- END IF
-
- WHILE exitcode = 2
-
- GET #datfile, curmasrec, RecField
-
- GetBackground 1, 1, 25, 79, fs$
-
- DispRecField RecField
-
- ixv = RecFieldNumIDX
-
- BO$ = " Next Prev Search Insert Formats" + CHR$(255) + "information Quit "
-
- Imopt = MenuBar(25, 3, BO$, BLACK, WHITE, RED, 4)
-
- IF Imopt = 3 THEN
- exitcode = 0
- END IF
-
- IF Imopt = 4 THEN 'insert field
-
- PutBackground 1, 1, fs$
- fs$ = ""
- MID$(scrnline$(y%), x%, LEN(RTRIM$(RecField.format))) = STRING$(LEN(RTRIM$(RecField.format)), CHR$(219))
- fl$ = RecField.format
- Trim fl$
-
- FOR fp% = x% TO x% + LEN(fl$) - 1
- fieldpointer%(y%, fp%) = curmasrec
- NEXT
-
- RecField.erow = strval$(y%)
- RecField.ecol = strval$(x%)
-
- PUT #datfile, curmasrec, RecField
-
- pnc scrnline$(y%), y%, 1, fg%, bg%
-
- EXIT DO
- END IF
-
- IF Imopt = 5 THEN
-
- formatinfo
- proginfo1
- proginfo2
- mainscreen
-
- END IF
-
- IF Imopt = 6 THEN
- PutBackground 1, 1, fs$
- fs$ = ""
-
- EXIT DO
- END IF
- IF Imopt = 1 THEN
- PIM "N", ixv, nul$, curmasrec, IndexRec
- END IF
-
- IF Imopt = 2 THEN
- PIM "P", ixv, nul$, curmasrec, IndexRec
- END IF
- WEND
- LOOP
-
- CASE 61 'F3 Display definition
-
- IF fieldset% THEN
- nav% = fieldpointer%(y%, x%)
- GetBackground 1, 1, 25, 79, fs$
- fp% = fieldpointer%(y%, x%)
-
- IF fp% THEN
-
- GET #datfile, fp%, RecField
- LOCATE , , 0, 0
- DispRecField RecField
- waitkey 24, fg%, bg%
- END IF
-
- PutBackground 1, 1, fs$
- fs$ = ""
- ELSE
- fid$ = " "
- END IF
-
- CASE 62 'F4 delete field info from screen
-
- IF fieldset% THEN
- fp% = fieldpointer%(y%, x%)
- IF fp% THEN
- GET #datfile, fp%, RecField
- fid$ = RecField.name
- END IF
-
- MID$(scrnline$(y%), x%, LEN(RTRIM$(RecField.format))) = STRING$(LEN(RTRIM$(RecField.format)), CHR$(32))
- fl$ = RecField.format
- Trim fl$
-
- FOR fp% = x% TO x% + LEN(fl$) - 1
- fieldpointer%(y%, fp%) = 0
- NEXT
-
- RecField.erow = strval$(0)
- RecField.ecol = strval$(0)
- pnc scrnline$(y%), y%, 1, fg%, bg%
- END IF
-
- CASE 63 'F5
- CASE 64 'F6
- CASE 65 'F7
-
- CASE 66 'F8 select alt char
-
- FOR j% = 1 TO 70
- fl$(j%) = CHR$(j% + 173)
- NEXT j%
- LOCATE , , 0, 0
-
- ch% = SelBox%(fl$(), 70, 8, 1, fg%, bg%, rev%)
- lsch% = ASC(fl$(ch%))
- ctype% = 1
-
- CASE 67 'F9 Repeat last Alternate Character
-
- ch% = lsch%
- ctype% = 1
-
- CASE 82 ' Insert on / off
-
- IF ins$ = "Off" THEN
- ins$ = "On "
- ELSE
- ins$ = "Off"
- END IF
-
- CASE 83 ' Delete
-
- IF fieldpointer%(y%, x%) = 0 THEN
-
- IF x% = 1 THEN
- scrnline$(y%) = MID$(scrnline$(y%), 2, 80) + " "
- ELSEIF x% = 80 THEN
- MID$(scrnline$(y%), 80, 1) = " "
- ELSEIF (x% > 1 AND x% < 80) THEN
- pref$ = MID$(scrnline$(y%), 1, x% - 1)
- post$ = MID$(scrnline$(y%), x% + 1, 79)
- scrnline$(y%) = pref$ + post$ + " "
- END IF
-
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
-
- IF INSTR(scrnline$(y%), CHR$(219)) THEN
-
- fieldpointer%(y%, 80) = 0
-
- FOR k% = (x% - 1) TO 79
- SWAP fieldpointer%(y%, k%), fieldpointer%(y%, k% + 1)
- NEXT k%
-
- GOSUB updateREC
-
- END IF
- END IF
- END SELECT
-
- CASE ELSE
-
- END SELECT
-
- IF editmode% = 0 OR (drawhorzlin% = 1 OR drawboxlin% = 1) THEN
- IF ch% = 75 THEN ' Left Arrow
- x% = x% - 1
- END IF
-
- IF ch% = 77 THEN ' Right Arrow
- x% = x% + 1
- END IF
- END IF
-
- IF editmode% = 0 OR (drawvertlin% = 1 OR drawboxlin% = 1) THEN
- IF ch% = 72 THEN ' Up Arrow
- y% = y% - 1
- END IF
-
- IF ch% = 80 THEN ' Down Arrow
- y% = y% + 1
- END IF
- END IF
-
- IF ctype% = 1 THEN
-
- IF ch% = 13 THEN
- IF editmode% = 0 THEN
- x% = 1
- y% = y% + 1
- END IF
- IF crx% > x% THEN
- stx% = x%
- enx% = crx%
- ELSE
- stx% = crx%
- enx% = x%
- END IF
- IF cry% > y% THEN
- sty% = y%
- eny% = cry%
- ELSE
- sty% = cry%
- eny% = y%
- END IF
- IF editmode% = 1 THEN
- IF drawhorzlin% = 1 THEN ' Complete horizontal line
-
- fl$(1) = STRING$(5, 196)
- fl$(2) = STRING$(5, 205)
- fl$(3) = STRING$(5, "-")
- fl$(4) = STRING$(5, "_")
- fl$(5) = STRING$(5, "=")
- fl$(6) = STRING$(5, " ")
-
- LOCATE , , 0, 0
-
- SB% = SelBox(fl$(), 6, 5, 5, BLACK, WHITE, RED)
- OPT$ = fl$(SB%)
- IF LEN(OPT$) <> 0 THEN
- FOR drawhorzlin% = stx% TO enx%
- MID$(scrnline$(y%), drawhorzlin%, 1) = CHR$(ASC(OPT$))
- NEXT drawhorzlin%
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
- END IF
- drawhorzlin% = 0
- END IF
-
- IF drawvertlin% = 1 THEN ' Complete vertical line
-
- fl$(1) = CHR$(179)
- fl$(2) = CHR$(186)
- fl$(3) = "|"
- fl$(4) = " "
-
- LOCATE , , 0, 0
-
- SB% = SelBox(fl$(), 4, 4, 2, BLACK, WHITE, RED)
- OPT$ = fl$(SB%)
-
- IF LEN(OPT$) <> 0 THEN
- FOR drawvertlin% = sty% TO eny%
- MID$(scrnline$(drawvertlin%), x%, 1) = CHR$(ASC(OPT$))
- CALL pnc(scrnline$(drawvertlin%), drawvertlin%, 1, fg%, bg%)
- NEXT drawvertlin%
- END IF
- drawvertlin% = 0
- END IF
-
- IF drawboxlin% = 1 THEN ' Complete box
- fl$(1) = CHR$(218) + CHR$(196) + CHR$(191)
- fl$(2) = CHR$(213) + CHR$(205) + CHR$(184)
- fl$(3) = CHR$(214) + CHR$(196) + CHR$(183)
- fl$(4) = CHR$(201) + CHR$(205) + CHR$(187)
- fl$(5) = CHR$(32) + CHR$(32) + CHR$(32)
-
- LOCATE , , 0, 0
-
- SB% = SelBox(fl$(), 5, 4, 3, BLACK, WHITE, RED)
- OPT$ = fl$(SB%)
-
- IF LEN(OPT$) <> 0 THEN
- box.t% = ASC(OPT$)
- SELECT CASE ASC(OPT$)
- CASE 32
- tl% = 32: tr% = 32: bl% = 32: br% = 32: vt% = 32: hz% = 32
- CASE 218
- tl% = 218: tr% = 191: bl% = 192: br% = 217: vt% = 179: hz% = 196
- CASE 213
- tl% = 213: tr% = 184: bl% = 212: br% = 190: vt% = 179: hz% = 205
- CASE 201
- tl% = 201: tr% = 187: bl% = 200: br% = 188: vt% = 186: hz% = 205
- CASE 214
- tl% = 214: tr% = 183: bl% = 211: br% = 189: vt% = 186: hz% = 196
- CASE ELSE
- END SELECT
-
- FOR bx% = stx% + 1 TO enx% - 1
- MID$(scrnline$(sty%), bx%, 1) = CHR$(hz%)
- MID$(scrnline$(eny%), bx%, 1) = CHR$(hz%)
- NEXT bx%
-
- FOR bx% = sty% + 1 TO eny% - 1
- MID$(scrnline$(bx%), stx%, 1) = CHR$(vt%)
- MID$(scrnline$(bx%), enx%, 1) = CHR$(vt%)
- NEXT bx%
-
- MID$(scrnline$(sty%), stx%, 1) = CHR$(tl%)
- MID$(scrnline$(eny%), stx%, 1) = CHR$(bl%)
- MID$(scrnline$(sty%), enx%, 1) = CHR$(tr%)
- MID$(scrnline$(eny%), enx%, 1) = CHR$(br%)
-
- FOR bx% = sty% TO eny%
- CALL pnc(scrnline$(bx%), bx%, 1, fg%, bg%)
- NEXT bx%
- END IF
- drawboxlin% = 0
- END IF
- editmode% = 0
- END IF
- END IF
-
- IF editmode% = 0 THEN
- IF ch% = 8 THEN
- MID$(scrnline$(y%), x%, 1) = CHR$(32)
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
- x% = x% - 1
- END IF
-
- IF ch% = 127 THEN
- IF x% = 1 THEN
- scrnline$(y%) = MID$(scrnline$(y%), 2, 80) + " "
- END IF
- IF x% = 80 THEN
- MID$(scrnline$(y%), 80, 1) = " "
- END IF
-
- IF (x% > 1 AND x% < 80) THEN
- pref$ = MID$(scrnline$(y%), 1, x% - 1)
- post$ = MID$(scrnline$(y%), x% + 1, 79)
- scrnline$(y%) = pref$ + post$ + " "
- END IF
-
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
- END IF
-
- IF ch% = 9 THEN
- x% = x% + 8
- END IF
-
- IF (ch% > 31 AND ch% < 127) OR (ch% > 173 AND ch% < 254) THEN
- IF fieldpointer%(y%, x%) = 0 THEN
-
- IF ins$ = "Off" THEN
- MID$(scrnline$(y%), x%, 1) = CHR$(ch%)
-
- ELSE ' ins$ = "On "
-
- IF x% = 1 THEN
- scrnline$(y%) = CHR$(ch%) + MID$(scrnline$(y%), 1, 79)
- END IF
-
- IF x% = 80 THEN
- MID$(scrnline$(y%), 80, 1) = CHR$(ch%)
- END IF
-
- IF (x% > 1 AND x% < 80) THEN
- pref$ = MID$(scrnline$(y%), 1, x% - 1)
- post$ = MID$(scrnline$(y%), x%, 79)
- scrnline$(y%) = pref$ + CHR$(ch%) + post$
- END IF
-
- IF LEN(scrnline$(y%)) > 80 THEN
- scrnline$(y%) = MID$(scrnline$(y%), 1, 80)
- END IF
- IF INSTR(scrnline$(y%), CHR$(219)) THEN
- xs% = x% - 1
- FOR k% = 79 TO xs% STEP -1
- SWAP fieldpointer%(y%, k%), fieldpointer%(y%, k% + 1)
- NEXT k%
- GOSUB updateREC
- END IF
- END IF
-
- CALL pnc(scrnline$(y%), y%, 1, fg%, bg%)
-
- x% = x% + 1
-
- END IF
- END IF
- END IF
- END IF
-
- IF y% > ymax% THEN
- y% = ymin%
- ELSEIF y% < ymin% THEN
- y% = ymax%
- ELSEIF x% > xmax% THEN
- x% = xmin%
- ELSEIF x% < xmin% THEN
- x% = xmax%
- END IF
-
- WEND
-
- EXIT SUB
-
- updateREC:
- prevfp% = 0
- FOR i% = 1 TO 25
- prevfp% = 0
-
- IF INSTR(scrnline$(i%), CHR$(219)) THEN
-
- FOR k% = 1 TO 80
-
- fp% = fieldpointer%(i%, k%)
- IF fp% THEN
- IF fp% <> prevfp% THEN
- GET #datfile, fp%, RecField
- RecField.erow = strval$(i%)
- RecField.ecol = strval$(k%)
- PUT #datfile, fp%, RecField
- END IF
- END IF
-
- prevfp% = fieldpointer%(i%, k%)
-
- NEXT k%
- END IF
- NEXT i%
- initindex
- RETURN
-
- END SUB
-
- SUB clearscreen
- FOR j% = 1 TO 25
- scrnline$(j%) = STRING$(80, 32)
- FOR k% = 1 TO 80
- fieldpointer%(j%, k%) = 0
- NEXT k%
- NEXT j%
-
- END SUB
-
- SUB createdatafile
-
- redofile:
-
- DrawBox 21, 22, 40, 3, 2, BLACK, WHITE, 1, BLACK, WHITE, 1
- CenterText "Enter Name For New Database", 22, BLACK, WHITE
-
- MsgOpt$(1) = "Enter new file specification"
- ans$ = ""
-
- DialogBox MsgOpt$(), 1, 1, 8, BLACK, WHITE, BLACK, WHITE, 1, ans$, "", Ek
- IF Ek = 7 THEN
- EXIT SUB
- END IF
- filespec$ = ans$
-
- delimit = INSTR(filespec$, ".")
-
- IF delimit THEN
- FileName$ = LEFT$(filespec$, delimit - 1)
- fileext$ = RIGHT$(filespec$, LEN(filespec$) - (delimit))
- ELSE
- FileName$ = filespec$
- fileext$ = "FLD"
- END IF
-
- IF LEN(filespec$) = 0 OR LEN(FileName$) > 8 OR LEN(fileext$) > 3 THEN
- MsgOpt$(1) = "You didn't enter a valid file specification."
- MsgOpt$(2) = ""
- MsgOpt$(3) = "Press any key to continue"
- Message MsgOpt$(), 3, 3, BLACK, WHITE + 8, BLACK, WHITE
- GOTO redofile
- END IF
- Trim FileName$
- MASTERFILE$ = FileName$ + "." + fileext$
-
- END SUB
-
- SUB DispRecField (temp AS RecordType)
-
- 'Display details on screen
-
- fg = BLACK
- bg = WHITE
-
- TopRow = 7
- LeftCol = 5
- botrow = 20
- rightcol = 74
- FrameType = 2
-
- 'draw frame
-
- CALL drawwind(TopRow, LeftCol, botrow, rightcol, FrameType, 1)
- 'color frame
- CALL Colorwind(TopRow, LeftCol, botrow, rightcol, 0, 1, fg, bg)
-
- pnc "Field Name : ", 9, 8, fg, bg
- pnc "Key (Y/N) : ", 10, 8, fg, bg
- pnc "Field Format: ", 11, 8, fg, bg
- pnc "Field Length: ", 12, 8, fg, bg
- pnc "Type : ", 13, 8, fg, bg
- pnc "Case (U/L/A): ", 14, 8, fg, bg
- pnc "Number Dec : ", 15, 8, fg, bg
- pnc "Row Pos : ", 16, 8, fg, bg
- pnc "Col Pos : ", 17, 8, fg, bg
- pnc "Comment : ", 18, 8, fg, bg
- pnc "Program name: ", 19, 8, fg, bg
-
- pnc temp.name, 9, 21, fg, bg
- pnc temp.key, 10, 21, fg, bg
- pnc temp.format, 11, 21, fg, bg
- pnc temp.length, 12, 21, fg, bg
- pnc temp.type, 13, 21, fg, bg
- pnc temp.case, 14, 21, fg, bg
- pnc temp.decimal, 15, 21, fg, bg
- pnc temp.erow, 16, 21, fg, bg
- pnc temp.ecol, 17, 21, fg, bg
- pnc temp.comment, 18, 21, fg, bg
- pnc temp.progname, 19, 21, fg, bg
-
- END SUB
-
- SUB initindex STATIC
-
- DIM TempField AS RecordType
-
- FOR j% = 0 TO 24
- FOR k% = 0 TO 80
- fieldpointer%(j%, k%) = 0
- NEXT k%
- NEXT j%
-
- LastREC = LOF(datfile) \ LEN(TempField)
-
- numberoffields = 0
- FOR record = 1 TO LastREC
-
- ' Read a record from the file and put each field in the array.
-
- GET #datfile, record, TempField
-
- IF TempField.status = "U" THEN
-
- Findex(record).status = TempField.status
- Findex(record).Num = TempField.Num
- Findex(record).name = TempField.name
- Findex(record).type = TempField.type
- Findex(record).case = TempField.case
- Findex(record).key = TempField.key
- Findex(record).decimal = TempField.decimal
- Findex(record).length = TempField.length
- Findex(record).format = TempField.format
- Findex(record).erow = TempField.erow
- Findex(record).ecol = TempField.ecol
- Findex(record).comment = TempField.comment
- Findex(record).progname = TempField.progname
- Findex(record).recnum = record
-
- fl$ = TempField.format
- Trim fl$
- FOR fieldREC% = VAL(TempField.ecol) TO VAL(TempField.ecol) + LEN(fl$) - 1
- fieldpointer%(VAL(TempField.erow), fieldREC%) = record
- NEXT
-
- numberoffields = numberoffields + 1
- END IF
- NEXT record
- END SUB
-
- '
- SUB RecFieldselect (indexnum, key$, MastRec, IndexRec, exitcode) STATIC
-
- fg = WHITE
- bg = BLUE
-
- REDIM dg$(5)
- REDIM TempMasREC(10)
- REDIM TempIdxREC(10)
-
- CONST CORRUPT = "Error: PIM Index Corrupt"
- CONST EX$ = " ESC = Exit ENTER = Select ? = Key search " ' F1 = Options "
-
- 'define select option window
-
- row = 6
- col = 3
- lin = 10
- numofsel = 0
-
- exitcode = 0 'What's selected
- bodertype = 2 'Border typeincode
-
- Nf = BLACK 'Normal Foreground
- Nb = WHITE 'Normal Background
- sf = WHITE + 8 'Select Foreground
- SB = BLACK 'Select Background
- ff = YELLOW 'Frame Foreground
- Fb = BLACK 'Frame Background
-
- 'end of select option's
-
- MsgLine EX$, 25, 0, 7
-
- restart:
-
- IF PIMstats(indexnum) = 0 THEN 'No keys in the index
- curmasrec = 0
- IndexRec = 0
- exitcode = 0 'code No keys in the Index
- EXIT SUB
- END IF
-
- KeyLen = 20
- skey$ = "FIELD NAME"
- dg$(1) = "Enter FIELD NAME"
- dg$(2) = "An exact match is not needed."
-
- height = lin
- startpos = height
- col = 80 / 2 - KeyLen / 2
- dwidth = KeyLen 'Maximum(KeyLen, LEN(Ex$))
-
- Trim dg$(1)
- Trim dg$(2)
-
- Dwidth2 = dwidth
- dwidth = dwidth + 4
-
- totalheight = height + 2 'Scroll box height (plus borders)
- totalheight = totalheight + 2 'Quit Box + ESC + lineNum
- checkheight = totalheight + row - 1 'Check the complete height
-
- IF checkheight > MAXROW THEN
- curmasrec = 0
- IndexRec = 0
- EXIT SUB
- END IF
-
- CheckWidth = dwidth + col - 1
-
- IF CheckWidth > 80 THEN
- curmasrec = 0
- IndexRec = 0
- EXIT SUB
- END IF
- 'Save Screen
-
- GetBackground row, col, row + totalheight + 2, col + dwidth + 1, buf$
- DrawBox row, col, dwidth, totalheight, bodertype, ff, Fb, 1, Nf, Nb, 0
-
- Crow = row + height + 1
- Ccol = col + 2
- Acc$ = STRING$(dwidth - 2, 196)
-
- pnc Acc$, Crow, Ccol - 1, ff, Fb
-
- Crow = row + height + 2
- kcol = Ccol + KeyLen / 2 - LEN(skey$) / 2
-
- pnc skey$, Crow, kcol, ff, Fb
-
- GOSUB homeCkeys 'Display from the top
- GOSUB DisplayCkeys 'Display the Ckeys
- CurrentROW = 1 'Current Row
-
- DO 'Loop
- Acc$ = DispLine$(CurrentROW)
-
- IF LEN(Acc$) < Dwidth2 - 2 THEN
- Acc$ = Acc$ + STRING$(Dwidth2 - LEN(Acc$), 32)
- END IF
-
- Crow = CurrentROW + row
- pnc Acc$, Crow, Ccol, sf, SB
-
- kbd$ = ""
-
- WHILE kbd$ = ""
- kbd$ = INKEY$
- WEND
-
- IF LEN(kbd$) = 1 THEN
- useroption = ASC(RIGHT$(kbd$, 1))
-
- SELECT CASE useroption
-
- CASE 63 '? search key
-
- DialogBox dg$(), 1, 1, 20, ff, Fb, Nf, Nb, 1, ans$, "", Exk
-
- key$ = ans$
- 'IndexFind
- PIM "S", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
- GOSUB getrecinfo
- DispLine$(1) = DispLine$
- TempMasREC(1) = ABS(MastRec)
- TempIdxREC(1) = IndexRec
-
- ELSE
- PRINT CORRUPT
- END
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- GOSUB GetNextCten
- CurrentROW = 1
- GOSUB DisplayCkeys
-
- CASE 48 TO 57, 65 TO 90, 97 TO 122 'first letter search
- 'IndexFind
- key$ = UCASE$(CHR$(useroption))
-
- PIM "S", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
- GOSUB getrecinfo
- DispLine$(1) = DispLine$
- TempMasREC(1) = ABS(MastRec)
- TempIdxREC(1) = IndexRec
-
- ELSE
- PRINT CORRUPT
- END
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- GOSUB GetNextCten
- CurrentROW = 1
- GOSUB DisplayCkeys
-
- CASE 27 'ESCAPE
- key$ = ""
- MastRec = 0
- IndexRec = 0
- exitcode = 1 ' ESC
- EXIT DO
-
- CASE 13 'RETURN
- key$ = DispLine$(CurrentROW)
- MastRec = TempMasREC(CurrentROW)
- IndexRec = TempIdxREC(CurrentROW)
- exitcode = 2 ' RETURN
- EXIT DO
-
- CASE ELSE
- END SELECT
-
- END IF
-
- IF LEN(kbd$) = 2 THEN
- useroption = ASC(RIGHT$(kbd$, 1))
-
- SELECT CASE useroption
-
- CASE 59
-
- Fkey = useroption - 58
- IF numofsel >= Fkey THEN
- exitcode = Fkey
- key$ = DispLine$(CurrentROW)
- MastRec = TempMasREC(CurrentROW)
- IndexRec = TempIdxREC(CurrentROW)
-
- menu$ = "1 - Search by NAME\"
- menu$ = menu$ + "2 - Search by length\"
-
- indexnum = MenuWindow(0, 0, menu$, "Search option", BLACK, WHITE, RED, 0)
-
- PutBackground row, col, buf$
- buf$ = ""
- MsgLine EX$, 25, 0, 7
-
- GOTO restart
- END IF
-
- CASE 71 'Home
- CurrentROW = 1
- GOSUB homeCkeys
- GOSUB DisplayCkeys
-
- CASE 81 'pg Down
- CurrentROW = 1
- FOR lineNum = 1 TO height
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- PrevMastRec = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- PIM "N", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
- GOSUB getrecinfo
- DispLine$(1) = DispLine$
- TempMasREC(1) = MastRec
- TempIdxREC(1) = IndexRec
-
- ELSE
- PRINT CORRUPT
- END
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- GOSUB GetNextCten
- GOSUB DisplayCkeys
-
- CASE 73 'pg Up
- CurrentROW = 1
- GOSUB GetLastCpage
- GOSUB DisplayCkeys
-
- CASE 79 'End
- IF startpos >= height THEN
- CurrentROW = 1
- GOSUB endCkeys
- GOSUB DisplayCkeys
- END IF
- CASE 80 'Down Arrow
- CurrentROW = CurrentROW + 1
- IF CurrentROW > height THEN
- CurrentROW = CurrentROW - 1
-
- IF TempIdxREC(height) <> 0 THEN
- key$ = DispLine$(height)
- MastRec = TempMasREC(height)
- IndexRec = TempIdxREC(height)
- PrevIndexRec = IndexRec
- 'IndexNext
- PIM "N", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec <> 0 THEN
- IF PrevIndexRec <> IndexRec THEN
- FOR lineNum = 1 TO height - 1
- TempIdxREC(lineNum) = TempIdxREC(lineNum + 1)
- TempMasREC(lineNum) = TempMasREC(lineNum + 1)
- DispLine$(lineNum) = DispLine$(lineNum + 1)
- NEXT lineNum
- GOSUB getrecinfo
- DispLine$(height) = DispLine$
- TempMasREC(height) = MastRec
- TempIdxREC(height) = IndexRec
- END IF
- END IF
- END IF
- ELSE
- IF TempIdxREC(CurrentROW) = 0 THEN
- CurrentROW = CurrentROW - 1
- END IF
- END IF
- GOSUB DisplayCkeys
-
- CASE 72 'Up Arrow
- CurrentROW = CurrentROW - 1
- IF CurrentROW < 1 THEN
- CurrentROW = CurrentROW + 1
-
- IF TempIdxREC(1) <> 0 THEN
- key$ = DispLine$(1)
- MastRec = TempMasREC(1)
- IndexRec = TempIdxREC(1)
- PrevIndexRec = IndexRec
- 'IndexPrevious
- PIM "P", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec <> 0 THEN
- IF PrevIndexRec <> IndexRec THEN
- FOR lineNum = height TO 2 STEP -1
- TempIdxREC(lineNum) = TempIdxREC(lineNum - 1)
- TempMasREC(lineNum) = TempMasREC(lineNum - 1)
- DispLine$(lineNum) = DispLine$(lineNum - 1)
- NEXT lineNum
- GOSUB getrecinfo
- DispLine$(1) = DispLine$
- TempMasREC(1) = MastRec
- TempIdxREC(1) = IndexRec
- END IF
- END IF
- END IF
- ELSE
- IF TempIdxREC(CurrentROW) = 0 THEN
- CurrentROW = CurrentROW + 1
- END IF
- END IF
- GOSUB DisplayCkeys
-
- CASE ELSE
- END SELECT
- END IF
- LOOP
-
- 'Restore Screen
-
- PutBackground row, col, buf$
- buf$ = ""
- EXIT SUB
-
- DisplayCkeys:
-
- FOR lineNum = 1 TO height
- Acc$ = DispLine$(lineNum)
- IF LEN(Acc$) < Dwidth2 THEN
- Acc$ = Acc$ + STRING$(Dwidth2 - LEN(Acc$), 32)
- END IF
- Crow = row + lineNum
- pnc Acc$, Crow, Ccol, Nf, Nb
- NEXT lineNum
- startpos = lineNum
- RETURN
-
- homeCkeys:
-
- FOR lineNum = 1 TO height
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- PrevMastRec = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- PIM "F", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
-
- GOSUB getrecinfo
- DispLine$(1) = DispLine$
- TempMasREC(1) = MastRec
- TempIdxREC(1) = IndexRec
-
- ELSE
- PRINT CORRUPT
- END
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- CurrentROW = 1
-
- GetNextCten:
-
- FOR lineNum = 2 TO height
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- FOR lineNum = 2 TO height
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
-
- PIM "N", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec > 0 THEN
- IF PrevMastRec = MastRec AND IndexRec = PrevIndexRec THEN
- EXIT FOR
- ELSE
- GOSUB getrecinfo
- DispLine$(lineNum) = DispLine$
- TempMasREC(lineNum) = MastRec
- TempIdxREC(lineNum) = IndexRec
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- END IF
- ELSE
- EXIT FOR
- END IF
- NEXT lineNum
-
- RETURN
-
- endCkeys:
- dsppos = 1
- FOR lineNum = 1 TO height
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- PIM "L", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
-
- GOSUB getrecinfo
- DispLine$(height) = DispLine$
- TempMasREC(height) = MastRec
- TempIdxREC(height) = IndexRec
- ELSE
- PRINT CORRUPT
- END
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
- CurrentROW = 1
-
- GetPreviousCten:
-
- FOR lineNum = 1 TO height - 1
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
- startpos = 1
- FOR lineNum = height - 1 TO 1 STEP -1
-
- DispLine$(lineNum) = STRING$(KeyLen, 32)
-
- PIM "P", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec > 0 THEN
- IF PrevIndexRec = IndexRec AND PrevMastRec = MastRec THEN
-
- EXIT FOR
- ELSE
- startpos = startpos + 1
- GOSUB getrecinfo
- DispLine$(lineNum) = DispLine$
- TempMasREC(lineNum) = MastRec
- TempIdxREC(lineNum) = IndexRec
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
- startrpos = startpos + 1
-
- END IF
- ELSE
-
- EXIT FOR
- END IF
- NEXT lineNum
-
- RETURN
-
- GetnextCpage:
-
- key$ = DispLine$(height)
- MastRec = TempMasREC(height)
-
- FOR lineNum = 1 TO 2
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- PrevMastRec = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- PIM "N", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
- GOSUB getrecinfo
- DispLine$(1) = DispLine$
- TempMasREC(1) = MastRec
- TempIdxREC(1) = IndexRec
- ELSE
- GOTO endCkeys
- RETURN
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
- CurrentROW = 1
-
- GetNextCpg:
-
- FOR lineNum = 2 TO height
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- FOR lineNum = 2 TO height
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
-
- 'get Next record
- PIM "N", indexnum, key$, MastRec, IndexRec
- IF IndexRec > 0 THEN
- IF PrevMastRec = MastRec AND IndexRec = PrevIndexRec THEN
- GOTO endCkeys
-
- ELSE
- GOSUB getrecinfo
- DispLine$(lineNum) = DispLine$
- TempMasREC(lineNum) = MastRec
- TempIdxREC(lineNum) = IndexRec
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- END IF
- ELSE
-
- GOTO endCkeys
-
- END IF
-
- NEXT lineNum
-
- RETURN
-
- GetLastCpage:
-
- key$ = DispLine$(1)
- MastRec = TempMasREC(1)
-
- FOR lineNum = 1 TO height
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- PIM "P", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec THEN
-
- GOSUB getrecinfo
- DispLine$(height) = DispLine$
- TempMasREC(height) = MastRec
- TempIdxREC(height) = IndexRec
- ELSE
- GOTO homeCkeys
- END IF
-
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
- CurrentROW = 1
-
- GetLastCpg:
-
- FOR lineNum = 1 TO height - 1
- TempMasREC(lineNum) = 0
- TempIdxREC(lineNum) = 0
- DispLine$(lineNum) = STRING$(KeyLen, 32)
- NEXT lineNum
-
- FOR lineNum = height - 1 TO 1 STEP -1
- DispLine$(lineNum) = STRING$(KeyLen, 32)
-
- PIM "P", indexnum, key$, MastRec, IndexRec
-
- IF IndexRec > 0 THEN
- IF PrevIndexRec = IndexRec AND PrevMastRec = MastRec THEN
- GOTO homeCkeys
- ELSE
- GOSUB getrecinfo
- DispLine$(lineNum) = DispLine$
- TempMasREC(lineNum) = MastRec
- TempIdxREC(lineNum) = IndexRec
- PrevMastRec = MastRec
- PrevIndexRec = IndexRec
-
- END IF
- END IF
- NEXT lineNum
-
- RETURN
-
- getrecinfo: 'add if more than key RecField is displayed
- '
- GET #datfile, MastRec, RecField
-
- cnam$ = RecField.name
- Cnum$ = RecField.Num
- 'RecField.progname
- 'RecField.length
- cph1$ = RecField.format
- 'trim tint$
- 'RecField.type
- 'RecField.case
- 'RecField.decimal
- 'RecField.comment
- 'RecField.erow
- tcap$ = RecField.ecol
-
- ' IF indexnum = 1 THEN
- DispLine$ = cnam$ 'add$' + " " + cph1$
- ' ELSE
- ' DispLine$ = cln$ + " " + tcap$
- ' END IF
- RETURN
-
- END SUB
-
- SUB seldatafile
- mainscreen
- MsgLine "Press " + CHR$(24) + " for last " + CHR$(25) + " for next ENTER to select", 25, 0, 7
-
- DrawBox 21, 22, 40, 3, 2, BLACK, WHITE, 1, BLACK, WHITE, 1
- CenterText "Select RecField Database", 22, BLACK, WHITE
- tryagian:
- filespec$ = SelFiles$("*.FLD")
- delimit = INSTR(filespec$, ".")
-
- IF delimit THEN
- FileName$ = LEFT$(filespec$, delimit - 1)
- fileext$ = RIGHT$(filespec$, LEN(filespec$) - (delimit))
- ELSE
- FileName$ = filespec$
- fileext$ = ".FLD"
- END IF
-
- Trim FileName$
- IF FileName$ = "" THEN
- MASTERFILE$ = ""
- ELSE
- MASTERFILE$ = FileName$ + "." + fileext$
- END IF
-
- END SUB
-
-