home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l196 / 3.ddi / BOOKMOD1.BA$ / BOOKMOD1.bin
Encoding:
Text File  |  1990-06-24  |  24.5 KB  |  610 lines

  1. '***********************************************************************
  2. '*      This is module level code for BOOKMOD2.BAS, and contains screen*
  3. '*      drawing and user interface maintenance routines. This module   *
  4. '*      doesn't contain ISAM statements.                               *
  5. '***********************************************************************
  6.  
  7. DEFINT A-Z
  8. '$INCLUDE: 'booklook.bi'
  9. KeysBox:
  10.   DATA "╔══════════════════════════════════════╗"
  11.   DATA "║                                      ║"
  12.   DATA "║                                      ║"
  13.   DATA "║                                      ║"
  14.   DATA "║                                      ║"
  15.   DATA "║                                      ║"
  16.   DATA "║                                      ║"
  17.   DATA "║                                      ║"
  18.   DATA "╚═╡ Keys for Database Viewing/Editing ╞╝"
  19.  
  20. HelpKeys1:
  21.   DATA ""
  22.   DATA "N = Next Record      P = Previous   "
  23.   DATA "R = Reorder Records  F = Find Record"
  24.   DATA "W = When Due Back    B = Borrower   "
  25.   DATA "      V = View Other Table          "
  26.   DATA "A = Add Record       D = Drop Record"
  27.   DATA "E = Edit Record      Q = Quit       "
  28.   DATA "O = Check Book Out   I = Check In   "
  29.   DATA ""
  30.  
  31. HelpKeys2:
  32.   DATA ""
  33.   DATA "N = Next Record      P = Previous   "
  34.   DATA "R = Reorder Records  F = Find Record"
  35.   DATA "      B = Books Outstanding         "
  36.   DATA "      V = View Other Table          "
  37.   DATA "A = Add Record       D = Drop Record"
  38.   DATA "E = Edit Record      Q = Quit       "
  39.   DATA "                                    "
  40.   DATA ""
  41.  
  42. Indexbox1:
  43.   DATA "╔═══════════════════════════╗"
  44.   DATA "║ By Titles                 ║"
  45.   DATA "║ By Authors                ║"
  46.   DATA "║ By Publishers             ║"
  47.   DATA "║ By ID numbers             ║"
  48.   DATA "║ By Title + Author + ID    ║"
  49.   DATA "║ Default = Insertion order ║"
  50.   DATA "║                           ║"
  51.   DATA "╚═╡ Current Sorting Order ╞═╝"
  52. Indexbox2:
  53.   DATA "╔═══════════════════════════╗"
  54.   DATA "║ By Name                   ║"
  55.   DATA "║ By State                  ║"
  56.   DATA "║ By Zip code               ║"
  57.   DATA "║ By Card number            ║"
  58.   DATA "║                           ║"
  59.   DATA "║ Default = Insertion order ║"
  60.   DATA "║                           ║"
  61.   DATA "╚═╡ Current Sorting Order ╞═╝"
  62.  
  63.  
  64. BooksTable:
  65. DATA "╔════════════════════════════════════════════════════════════════════╗"
  66. DATA "║                                                                    ║"
  67. DATA "║    Title:                                                          ║"
  68. DATA "║                                                                    ║"
  69. DATA "║    Author:                                                         ║"
  70. DATA "║                                                                    ║"
  71. DATA "║    Publisher:                                                      ║"
  72. DATA "║                                                                    ║"
  73. DATA "║    Edition:                                                        ║"
  74. DATA "║                                                                    ║"
  75. DATA "║    Price:                                                          ║"
  76. DATA "║                                                                    ║"
  77. DATA "║    ID number:                                                      ║"
  78. DATA "╚════════════════════════════════════════════════════════════════════╝"
  79.  
  80.  
  81. LendeesTable:
  82. DATA "╔════════════════════════════════════════════════════════════════════╗"
  83. DATA "║                                                                    ║"
  84. DATA "║   Name:                                                            ║"
  85. DATA "║                                                                    ║"
  86. DATA "║   Street:                                                          ║"
  87. DATA "║                                                                    ║"
  88. DATA "║   City:                                                            ║"
  89. DATA "║                                                                    ║"
  90. DATA "║   State:                                                           ║"
  91. DATA "║                                                                    ║"
  92. DATA "║   Zipcode:                                                         ║"
  93. DATA "║                                                                    ║"
  94. DATA "║   Card number:                                                     ║"
  95. DATA "╚════════════════════════════════════════════════════════════════════╝"
  96.  
  97. OperandBox:
  98. DATA "╔═══════════════════════════╗"
  99. DATA "║                           ║"
  100. DATA "║ Greater Than              ║"
  101. DATA "║ or                        ║"
  102. DATA "║ Equal To     Value Entered║"
  103. DATA "║ or                        ║"
  104. DATA "║ Less Than                 ║"
  105. DATA "║                           ║"
  106. DATA "╚══╡ Relationship to Key ╞══╝"
  107.  
  108. EditMessage:
  109. DATA "╔═══════════════════════════╗"
  110. DATA "║ A log is being kept while ║"
  111. DATA "║ you edit fields in this   ║"
  112. DATA "║ record. Press U to undo   ║"
  113. DATA "║ each preceding edit, or   ║"
  114. DATA "║ CTRL+U to undo all of the ║"
  115. DATA "║ pending edits as a group. ║"
  116. DATA "║                           ║"
  117. DATA "╚═════╡ To Undo Edits ╞═════╝"
  118.  
  119. '***************************************************************************
  120. '*  The ClearEm SUB erases the parts of the screen where table record col- *
  121. '*  umn information is displayed, depending on which fields are specified. *
  122. '*                                Parameters                               *
  123. '*  TableNum    Integer specifying the table being displayed               *
  124. '*  Field?      Boolean values specifying which fields to erase            *
  125. '***************************************************************************
  126. SUB ClearEm (TableNum%, Field1%, Field2%, Field3%, Field4%, Field5%, Field6%)
  127.  
  128.   DIM ToClear(10) AS INTEGER
  129.  
  130.   ToClear(0) = Field1: ToClear(1) = Field2: ToClear(2) = Field3
  131.   ToClear(3) = Field4: ToClear(4) = Field5: ToClear(5) = Field6
  132.   
  133.   COLOR FOREGROUND, BACKGROUND
  134.  
  135.       FOR Index = 0 TO 5
  136.         IF ToClear(Index) THEN
  137.           SELECT CASE Index
  138.             CASE 0
  139.               LOCATE TITLEFIELD, 18
  140.               PRINT "                                                    "
  141.             CASE 1
  142.               LOCATE AUTHORFIELD, 18
  143.               PRINT "                                                    "
  144.             CASE 2
  145.               LOCATE PUBFIELD, 18
  146.               PRINT "                                                    "
  147.             CASE 3
  148.               LOCATE EDFIELD, 18
  149.               PRINT "                                                    "
  150.             CASE 4
  151.               IF TableNum% = cCardHoldersTableNum THEN
  152.                 LOCATE PRICEFIELD, 18
  153.                 PRINT "                                                    "
  154.               ELSE
  155.                 LOCATE PRICEFIELD, 19
  156.                 PRINT "                                                   "
  157.               END IF
  158.             CASE 5
  159.               LOCATE IDFIELD, 18
  160.               PRINT "                                                    "
  161.           END SELECT
  162.         END IF
  163.       NEXT Index
  164. END SUB
  165.  
  166. '**************************************************************************
  167. '*  The ConfirmEntry FUNCTION echoes the user's input and processes his   *
  168. '*  response to make sure the proper action is taken.                     *
  169. '*                                 Parameters                             *
  170. '*  Letter$   Contains the input that the user has just entered.          *
  171. '**************************************************************************
  172. FUNCTION ConfirmEntry% (Letter$)
  173.   Alert$ = "Press ENTER to confirm choice, type value, or TAB to move on"
  174.   CALL ShowMessage(Alert$, 1)
  175.   DO
  176.   Answer$ = INKEY$
  177.   LOOP WHILE Answer$ = EMPTYSTRING
  178.   Reply% = ASC(Answer$)
  179.  
  180.   SELECT CASE Reply%
  181.     CASE ENTER
  182.       ConfirmEntry% = -1
  183.       Letter$ = ""
  184.     CASE TABKEY
  185.       ConfirmEntry% = 0
  186.       Letter$ = Answer$
  187.     CASE ASC(" ") TO ASC("~")
  188.       Letter$ = Answer$
  189.       ConfirmEntry = -1
  190.     CASE ELSE
  191.       ConfirmEntry% = 0
  192.       Letter$ = "eScApE"
  193.       CALL ShowMessage("Invalid key --- Try again", 0)
  194.    END SELECT
  195. END FUNCTION
  196.  
  197. '***************************************************************************
  198. '*    The DrawHelpBoox SUB draws the menu box that links a key to a task.  *
  199. '***************************************************************************
  200. SUB DrawHelpBox
  201.   COLOR FOREGROUND, BACKGROUND
  202.   RESTORE KeysBox
  203.     FOR Row = BOXTOP TO BOXEND
  204.       LOCATE Row, 1
  205.       READ Temp$
  206.       PRINT Temp$
  207.       IF Row = BOXEND THEN
  208.         COLOR BACKGROUND, FOREGROUND + BRIGHT
  209.         LOCATE Row, HELPCOL + 3
  210.         PRINT " Keys for Database Viewing/Editing "
  211.         COLOR FOREGROUND, BACKGROUND
  212.       END IF
  213.     NEXT Row
  214.   COLOR FOREGROUND, BACKGROUND
  215. END SUB
  216.  
  217. '***************************************************************************
  218. '*    The DrawHelpKeys SUB refills the menu box that links a key to a task.*
  219. '*                                Parameters                               *
  220. '*    TableNum    Integer identifying the table being displayed            *
  221. '***************************************************************************
  222. SUB DrawHelpKeys (TableNum AS INTEGER)
  223.  
  224. COLOR FOREGROUND, BACKGROUND
  225. IF TableNum = cBookStockTableNum THEN RESTORE HelpKeys1 ELSE RESTORE HelpKeys2
  226. FOR Row = BOXTOP TO BOXEND
  227.   LOCATE Row, HELPCOL + 2
  228.   READ Temp$
  229.   PRINT Temp$
  230.   IF Row = BOXEND THEN
  231.     COLOR BACKGROUND, FOREGROUND + BRIGHT
  232.     LOCATE Row, HELPCOL + 3
  233.     PRINT " Keys for Database Viewing/Editing "
  234.     COLOR FOREGROUND, BACKGROUND
  235.     END IF
  236. NEXT Row
  237. COLOR FOREGROUND, BACKGROUND
  238.  
  239. END SUB
  240.  
  241. '***************************************************************************
  242. '*  The DrawIndexBox procedure draws the appropriate index box, depending  *
  243. '*  the table being displayed. If the task is EDITRECORD, the index box    *
  244. '*  information is replaced with information about Undo and Undo All       *
  245. '*                               Parameters                                *
  246. '*  TableNum    Integer identifying the table being displayed              *
  247. '*  Task        Integer identifying the task the user is involved in       *
  248. '***************************************************************************
  249. SUB DrawIndexBox (TableNum AS INTEGER, Task%)
  250.  
  251. COLOR FOREGROUND, BACKGROUND
  252.  
  253. IF Task = EDITRECORD THEN
  254.   RESTORE EditMessage
  255. ELSE
  256.   IF TableNum = 1 THEN RESTORE Indexbox1 ELSE RESTORE Indexbox2
  257. END IF
  258.  
  259. FOR Row = BOXTOP TO BOXEND
  260.   LOCATE Row, 42
  261.   READ Temp$
  262.   PRINT Temp$
  263.   IF Row = BOXEND THEN
  264.     IF Task = EDITRECORD THEN
  265.       COLOR FOREGROUND + BRIGHT, BACKGROUND
  266.       LOCATE 19, INDBOX + 16
  267.       PRINT "U"
  268.       LOCATE 21, INDBOX + 2
  269.       PRINT "CTRL+U"
  270.       LOCATE Row, INDBOX + 7
  271.       PRINT " To Undo Edits "
  272.       COLOR FOREGROUND, BACKGROUND
  273.     ELSE
  274.       COLOR BACKGROUND, FOREGROUND + BRIGHT
  275.       LOCATE Row, INDBOX + 3
  276.       PRINT " Current Sorting Order "
  277.       COLOR FOREGROUND, BACKGROUND
  278.     END IF
  279.   END IF
  280. NEXT Row
  281. COLOR FOREGROUND, BACKGROUND
  282.  
  283. END SUB
  284.  
  285. '***************************************************************************
  286. '*  The DrawScreen SUB calls other procedures to draw the appropriate parts*
  287. '*  of the screen for the table to be displayed.                           *
  288. '*                                Parameters                               *
  289. '*  TableNum    Integer telling which table is to be shown                 *
  290. '***************************************************************************
  291. SUB DrawScreen (TableNum AS INTEGER)
  292.   CALL DrawTable(TableNum)
  293.   CALL DrawHelpBox
  294.   CALL DrawHelpKeys(TableNum)
  295.   CALL DrawIndexBox(TableNum, Task)
  296.   CALL ShowMessage("", 0)
  297.   COLOR FOREGROUND, BACKGROUND
  298. END SUB
  299.  
  300. '***************************************************************************
  301. '*  The DrawTable SUB draws and lables the table being displayed.          *
  302. '*                                Parameters                               *
  303. '*  TableNum    The number of the table currently being displayed          *
  304. '***************************************************************************
  305. SUB DrawTable (TableNum AS INTEGER)
  306. CALL ClearEm(TableNum, 1, 1, 1, 1, 1, 1)
  307. VIEW PRINT
  308. COLOR FOREGROUND, BACKGROUND
  309. SELECT CASE TableNum
  310.   CASE 1
  311.     TableName$ = " Book Stock Table "
  312.   CASE 2
  313.     TableName$ = " Card Holders Table "
  314. END SELECT
  315.  
  316. HowLong = LEN(TableName$)
  317. NameSpace$ = "╡" + STRING$(HowLong, 32) + "╞"
  318. PlaceName = (72 \ 2) - (HowLong \ 2)
  319.  
  320. IF TableNum = 1 THEN RESTORE BooksTable ELSE RESTORE LendeesTable
  321.  
  322. COLOR FOREGROUND, BACKGROUND
  323.  
  324. FOR Row = TABLETOP TO TABLEEND
  325.   LOCATE Row, 1
  326.   READ Temp$
  327.   PRINT Temp$
  328.   IF Row = TABLETOP THEN
  329.     LOCATE TABLETOP, PlaceName
  330.     PRINT NameSpace$
  331.     COLOR BACKGROUND, BRIGHT + FOREGROUND
  332.     LOCATE 1, PlaceName + 1
  333.     PRINT TableName$
  334.     COLOR FOREGROUND, BACKGROUND
  335.   END IF
  336. NEXT Row
  337. COLOR FOREGROUND, BACKGROUND
  338.  
  339. END SUB
  340.  
  341. '***************************************************************************
  342. '*  The EraseMessage SUB erases the message in the message box between the *
  343. '*  displayed table and the menus at the bottom of the screen. It replaces *
  344. '*  the corners of the table and menus that may have been overwritten      *
  345. '***************************************************************************
  346. SUB EraseMessage
  347.   COLOR FOREGROUND, BACKGROUND
  348.        LOCATE MESBOXTOP, 1
  349.        PRINT "╚"; STRING$(68, CHR$(205)); "╝"
  350.        LOCATE MESFIELD, 1
  351.        PRINT SPACE$(70)
  352.        LOCATE MESBOXEND, 1
  353.        PRINT "╔"; STRING$(38, CHR$(205)); "╗ ╔"; STRING$(27, CHR$(205)); "╗"
  354.  
  355. END SUB
  356.  
  357. '**************************** MakeString FUNCTION **************************
  358. '*                                                                         *
  359. '* The MakeString FUNCTION provides a minimal editor to operate in the     *
  360. '* BOOKLOOK message box. A prompt is shown. The user can enter numbers,    *
  361. '* letters, punctuation, the ENTER, BACKSPACE and ESC keys.                *
  362. '*                                                                         *
  363. '*                            Parameters:                                  *
  364. '*   FilterTrap   Brings in a keystroke or letter by ASCII value           *
  365. '*   ThisString   Prompt passed in depends on calling function             *
  366. '*                                                                         *
  367. '***************************************************************************
  368. FUNCTION MakeString$ (FilterTrap AS INTEGER, ThisString$)
  369.  
  370. MessageLen = LEN(ThisString$)                   ' Save length of the prompt
  371. IF FilterTrap THEN                              ' then, if a letter was
  372.   ThisString$ = ThisString$ + CHR$(FilterTrap)  ' passed in, add it to the
  373.   NewString$ = CHR$(FilterTrap)                 ' prompt and use it to start
  374. END IF                                          ' string to be returned.
  375. CALL ShowMessage(ThisString$, 1)                ' Show the string and turn
  376. DO                                              ' on cursor at end.
  377.   DO
  378.   Answer$ = INKEY$
  379.   LOOP WHILE Answer$ = EMPTYSTRING
  380.       SELECT CASE Answer$
  381.         CASE CHR$(ESCAPE)
  382.           FilterTrap = ESCAPE
  383.           CALL ShowMessage(KEYSMESSAGE, 0)
  384.           EXIT FUNCTION
  385.         CASE " " TO "~"
  386.           NewString$ = NewString$ + Answer$
  387.           ThisString$ = ThisString$ + Answer$
  388.           CALL ShowMessage(ThisString$, 1)
  389.         CASE CHR$(BACKSPACE)
  390.           ShortLen = LEN(ThisString$) - 1
  391.           ThisString$ = MID$(ThisString$, 1, ShortLen)
  392.           NewString$ = MID$(ThisString$, MessageLen + 1)
  393.           CALL ShowMessage(ThisString$, 1)
  394.         CASE CHR$(ENTER)
  395.           LOCATE , , 0
  396.           MakeString$ = LTRIM$(RTRIM$(NewString$))
  397.           EXIT FUNCTION
  398.         CASE ELSE
  399.           BEEP
  400.           CALL ShowMessage("Not a valid key --- press Space bar", 0)
  401.       END SELECT
  402. LOOP
  403. END FUNCTION
  404.  
  405. '***************************************************************************
  406. '*  The ReturnKey$ FUNCTION gets a key from the user and returns its value *
  407. '***************************************************************************
  408. FUNCTION ReturnKey$
  409.   DO
  410.     Answer$ = INKEY$
  411.   LOOP WHILE Answer$ = EMPTYSTRING
  412.   ReturnKey$ = Answer$
  413. END FUNCTION
  414.  
  415. '******************************** ShowIt SUB ******************************
  416. '*                                                                        *
  417. '*    After the user enters a value to search for in a specific index,    *
  418. '*    this SUB places the value in the proper element of the temporary    *
  419. '*    record variable, then displays the value in the field. Finally,     *
  420. '*    the user is prompted to choose the relationship the indexed value   *
  421. '*    should have to the key that has been entered.                       *
  422. '*                            Parameters:                                 *
  423. '*    TabesRec:       A temporary recordvariable - same as BigRec         *
  424. '*    WhichIndex:     Tells name of Index on which key should be sought   *
  425. '*    WhichTable:     The number of the table currently being displayed   *
  426. '*    StringTo Show:  Value user wants to search for in index             *
  427. '*                                                                        *
  428. '**************************************************************************
  429. SUB ShowIt (TablesRec AS RecStruct, WhichIndex$, WhichTable%, StringToShow$)
  430.   TablesRec.TableNum = WhichTable
  431.   TablesRec.WhichIndex = WhichIndex$
  432.   COLOR BRIGHT + FOREGROUND, BACKGROUND
  433.       SELECT CASE WhichIndex$
  434.         CASE "TitleIndexBS"
  435.           TablesRec.Inventory.Title = StringToShow$
  436.         CASE "AuthorIndexBS"
  437.           TablesRec.Inventory.Author = StringToShow$
  438.         CASE "PubIndexBS"
  439.           TablesRec.Inventory.Publisher = StringToShow$
  440.         CASE "IDIndex"
  441.           TablesRec.Inventory.IDnum = VAL(StringToShow$)
  442.         CASE "NameIndexCH"
  443.           TablesRec.Lendee.TheName = StringToShow$
  444.         CASE "StateIndexCH"
  445.           TablesRec.Lendee.State = StringToShow$
  446.         CASE "ZipIndexCH"
  447.           TablesRec.Lendee.Zip = VAL(StringToShow$)
  448.         CASE "CardNumIndexCH"
  449.           TablesRec.Lendee.CardNum = VAL(StringToShow$)
  450.       END SELECT
  451.     CALL ShowRecord(TablesRec)
  452.   COLOR FOREGROUND, BACKGROUND
  453. END SUB
  454.  
  455. '***************************************************************************
  456. '*  The ShowKeys SUB presents the key the user should press for a desired  *
  457. '*  operation associated with a description of the task.                   *
  458. '*                               Parameters                                *
  459. '*  TablesRec   RecStruct type variable containing table information       *
  460. '*  ForeGrnd    Integer indicating whether key is highlighted or not       *
  461. '*  TableDone   1 for No Next Record, 0 otherwise (usually DimN)           *
  462. '*  TableStart  1 for No Previous Record, 0 otherwise (usually DimP)       *
  463. '***************************************************************************
  464. SUB ShowKeys (TablesRec AS RecStruct, ForeGrnd%, TableDone%, TableStart%)
  465.   COLOR ForeGrnd, BACKGROUND                    'foreground bright
  466.   LOCATE NLINE, 3
  467.   PRINT "N"
  468.   LOCATE NLINE, 24
  469.   PRINT "P"
  470.   LOCATE RLINE, 3
  471.   PRINT "R"
  472.   LOCATE RLINE, 24
  473.   PRINT "F"
  474.   IF TablesRec.TableNum = cBookStockTableNum THEN
  475.     LOCATE WLINE, 3
  476.     PRINT "W"
  477.     LOCATE WLINE, 24
  478.     PRINT "B"
  479.   ELSE
  480.     LOCATE WLINE, 9
  481.     PRINT "B"
  482.   END IF
  483.   LOCATE VLINE, 9
  484.   PRINT "V"
  485.   LOCATE ALINE, 3
  486.   PRINT "A"
  487.   LOCATE ALINE, 24
  488.   PRINT "D"
  489.   LOCATE ELINE, 3
  490.   PRINT "E"
  491.   LOCATE ELINE, 24
  492.   PRINT "Q"
  493.   IF TablesRec.TableNum = cBookStockTableNum THEN
  494.     LOCATE CLINE, 3
  495.     PRINT "O"
  496.     LOCATE CLINE, 24
  497.     PRINT "I"
  498.   END IF
  499.   IF TableDone = TRUE THEN
  500.   
  501.     LOCATE NLINE, 3
  502.     PRINT " No Next Record"
  503.   ELSE
  504.     LOCATE NLINE, 3
  505.     PRINT "N "
  506.     COLOR FOREGROUND, BACKGROUND
  507.     LOCATE NLINE, 5
  508.     PRINT "= "
  509.     LOCATE NLINE, 6
  510.     PRINT " Next Record"
  511.   END IF
  512.   IF TableStart = TRUE THEN
  513.     COLOR ForeGrnd, BACKGROUND
  514.     LOCATE NLINE, 20
  515.     PRINT " No Previous Record"
  516.   ELSE
  517.     COLOR ForeGrnd, BACKGROUND
  518.     LOCATE NLINE, 20
  519.     PRINT "    P "
  520.     COLOR FOREGROUND, BACKGROUND
  521.     LOCATE NLINE, 26
  522.     PRINT "= "
  523.     LOCATE NLINE, 27
  524.     PRINT " Previous   "
  525.     END IF
  526.   COLOR FOREGROUND, BACKGROUND
  527. END SUB
  528.  
  529. '**************************************************************************
  530. '*  The ShowMessage SUB displays the message string passed in the message *
  531. '*  box between the displayed table and the menus. If the Cursor parameter*
  532. '*  is 0, no cursor appears in the box; if it is 1, a cursor is displaed. *
  533. '*                                 Parameters                             *
  534. '*  Message$    Prompt or message to display                              *
  535. '*  Cursor      Boolean value telling whether or not to show a cursor     *
  536. '**************************************************************************
  537. SUB ShowMessage (Message$, Cursor)
  538.   CALL EraseMessage
  539.   IF (LEN(Message$) MOD 2) THEN
  540.         Borderlen = 1
  541.   END IF
  542.   MesLen = LEN(Message$)
  543.   SELECT CASE Cursor                          ' No cursor request means to
  544.   CASE FALSE                                  ' center the message in box
  545.     HalfMes = (MesLen \ 2) + 1                ' and display without cursor
  546.     Start = (SCREENWIDTH \ 2) - HalfMes
  547.   CASE ELSE
  548.     Start = 4                                 ' Message is part of an edit
  549.   END SELECT                                  ' so display flush left, and
  550.     LOCATE MESBOXTOP, 2                       ' keep cursor visible
  551.     PRINT "╔"; STRING$(66, CHR$(205)); "╗"
  552.     LOCATE MESFIELD, 2
  553.     PRINT "║"; SPACE$(66); "║"
  554.     LOCATE MESBOXEND, 2
  555.     PRINT "╚"; STRING$(37, CHR$(205)); "╦"; "═╦"; STRING$(26, CHR$(205)); "╝"
  556.     COLOR BRIGHT + FOREGROUND, BACKGROUND
  557.     LOCATE MESFIELD, Start, Cursor
  558.     PRINT Message$;
  559.     LOCATE MESFIELD, Start + MesLen, Cursor
  560.     PRINT "";
  561.     COLOR FOREGROUND, BACKGROUND
  562. END SUB
  563.  
  564. '**************************************************************************
  565. '*  The ShowRecord SUB displays the columns of the current record of the  *
  566. '*  table being displayed. Numerics are only displayed if they are <> 0.  *
  567. '*                                Parameters                              *
  568. '*  TablesRec   RecStruct type variable containing table information      *
  569. '**************************************************************************
  570. SUB ShowRecord (TablesRec AS RecStruct)
  571. COLOR FOREGROUND, BACKGROUND
  572.   SELECT CASE TablesRec.TableNum
  573.     CASE cBookStockTableNum
  574.       LOCATE TITLEFIELD, 18: PRINT TablesRec.Inventory.Title
  575.       LOCATE AUTHORFIELD, 18: PRINT TablesRec.Inventory.Author
  576.       LOCATE PUBFIELD, 18: PRINT TablesRec.Inventory.Publisher
  577.       IF TablesRec.Inventory.Edition <> 0 THEN LOCATE EDFIELD, 17: PRINT STR$(TablesRec.Inventory.Edition)
  578.       IF TablesRec.Inventory.Price <> 0 THEN LOCATE PRICEFIELD, 17: PRINT " $"; STR$(TablesRec.Inventory.Price)
  579.       IF TablesRec.Inventory.IDnum <> 0 THEN LOCATE IDFIELD, 17: PRINT STR$(TablesRec.Inventory.IDnum)
  580.     CASE cCardHoldersTableNum
  581.       LOCATE NAMEFIELD, 18: PRINT TablesRec.Lendee.TheName
  582.       LOCATE STREETFIELD, 18: PRINT TablesRec.Lendee.Street
  583.       LOCATE CITYFIELD, 18: PRINT TablesRec.Lendee.City
  584.       LOCATE STATEFIELD, 18: PRINT TablesRec.Lendee.State
  585.       IF TablesRec.Lendee.Zip <> 0 THEN LOCATE ZIPFIELD, 17: PRINT STR$(TablesRec.Lendee.Zip)
  586.       IF TablesRec.Lendee.CardNum <> 0 THEN LOCATE CARDNUMFIELD, 17: PRINT STR$(TablesRec.Lendee.CardNum)
  587.     CASE ELSE
  588.        CALL ShowMessage("There are no other forms defined", 0)
  589.   END SELECT
  590. END SUB
  591.  
  592. '**************************************************************************
  593. '*  The UserChoice SUB is used to echo back to the user the most recent   *
  594. '*  menu selection he has made. Not all menu choices are echoed back.     *
  595. '*                                Parameters                              *
  596. '*  BigRec    RecStruct type variable containing table information        *
  597. '*  Row       Row on which to put the Feedback$                           *
  598. '*  Column    Column at which to start the Feedback$                      *
  599. '*  Feedback$ Menu-choice string to highlight                             *
  600. '**************************************************************************
  601. SUB UserChoice (BigRec AS RecStruct, Row, Column, Feedback$)
  602.     CALL DrawHelpKeys(BigRec.TableNum)
  603.     CALL ShowKeys(BigRec, BRIGHT + FOREGROUND, DimN, DimP)
  604.     COLOR FOREGROUND + BRIGHT, BACKGROUND
  605.     LOCATE Row, Column
  606.     PRINT Feedback$
  607.     COLOR FOREGROUND, BACKGROUND
  608. END SUB
  609.  
  610.