home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / QBSCR15.ZIP / DEMO.BAS < prev    next >
BASIC Source File  |  1989-09-01  |  45KB  |  1,248 lines

  1. '┌─────────────────────────────────────────────────────────────────────────┐
  2. '│                                                                         │
  3. '│                            D E M O . B A S                              │
  4. '│                                                                         │
  5. '│                  ░▒▓█  A Demonstration Program  █▓▒░                    │
  6. '│                                                                         │
  7. '│                   making known the capabilities of                      │
  8. '│                       the QBSCR Screen Routines                         │
  9. '│                                                                         │
  10. '├─────────────────────────────────────────────────────────────────────────┤
  11. '│                                                                         │
  12. '│  The QBSCR Screen Routines and this DEMO program are (C) Copyright 1989 │
  13. '│               by Tony Martin of the BAD SOFTWARE Company.               │
  14. '│                                                                         │
  15. '├─────────────────────────────────────────────────────────────────────────┤
  16. '│                                                                         │
  17. '│  Author  : Tony Martin                                                  │
  18. '│  Date    : September 1, 1989                                            │
  19. '│  Language: Microsoft QuickBASIC 4.0+                                    │
  20. '│                                                                         │
  21. '└─────────────────────────────────────────────────────────────────────────┘
  22.  
  23. '----------------------------------------------------------------------------
  24. ' CONSTants
  25. '----------------------------------------------------------------------------
  26. ' Color constants
  27. CONST BLACK = 0
  28. CONST BLUE = 1
  29. CONST GREEN = 2
  30. CONST CYAN = 3
  31. CONST RED = 4
  32. CONST MAGENTA = 5
  33. CONST BROWN = 6
  34. CONST WHITE = 7
  35. CONST BRIGHT = 8
  36. CONST YELLOW = BRIGHT + BROWN
  37. CONST BLINK = 16
  38.  
  39. ' General constants
  40. CONST FALSE = 0, TRUE = NOT FALSE
  41. CONST maxEntries = 13
  42.  
  43. '----------------------------------------------------------------------------
  44. ' SHARED variables (keep these to an absolute minimum)
  45. '----------------------------------------------------------------------------
  46. COMMON SHARED kolor%
  47.  
  48. '----------------------------------------------------------------------------
  49. ' DECLARE statements for the QBSCR Screen Routines
  50. '----------------------------------------------------------------------------
  51. DECLARE FUNCTION BlockSize% (l%, r%, t%, b%)
  52. DECLARE FUNCTION ColorChk ()
  53. DECLARE FUNCTION GetBackground% (row%, col%)
  54. DECLARE FUNCTION GetForeground% (row%, col%)
  55. DECLARE FUNCTION GetString$ (leftCol!, row%, strLen%, foreColor%, backColor%)
  56. DECLARE FUNCTION GetVideoSegment! ()
  57. DECLARE FUNCTION MakeMenu% (choice$(), numOfChoices%, justify$, leftColumn!, rightColumn!, row%, marker$, fg%, bg%, hfg%, hbg%, qfg%, qbg%)
  58. DECLARE FUNCTION SubMenu% (choice$(), currentMenu%, numOfChoices%, justify$, leftColumn!, rightColumn!, row%, marker$, fg%, bg%, hfg%, hbg%, qfg%, qbg%)
  59. DECLARE FUNCTION ScreenBlank$ (delay)
  60. DECLARE SUB Banner (st$, row%)
  61. DECLARE SUB BlockRestore (l%, r%, t%, b%, scrArray%(), segment!)
  62. DECLARE SUB BlockSave (l%, r%, t%, b%, scrArray%(), segment!)
  63. DECLARE SUB BuildScreen (file$, mode%)
  64. DECLARE SUB Center (st$, row%)
  65. DECLARE SUB ClrScr (mode%, fillChar$)
  66. DECLARE SUB DisplayEntry (entry$, qfg%, qbg%, hfg%, hbg%, fg%, bg%, marker$, actionCode%)
  67. DECLARE SUB GetScreen (file$)
  68. DECLARE SUB PutScreen (file$)
  69. DECLARE SUB MakeWindow (topRow!, leftCol!, botRow!, rightCol!, foreColor%, backColor%, windowType%, frameType%, shadowColor%, explodeType%, label$)
  70. DECLARE SUB MultiMenu (menusArray$(), numEntries%(), menuTitles$(), justify$, marker$, shadowCode%, fg%, bg%, hfg%, hbg%, qfg%, qbg%, menuSelected%, menuEntrySelected%)
  71. DECLARE SUB OffCenter (st$, row%, leftCol%, rightCol%)
  72. DECLARE SUB ScrnRestore (firstLine%, lastLine%, scrArray%(), segment)
  73. DECLARE SUB ScrnSave (firstLine%, lastLine%, scrArray%(), segment)
  74. DECLARE SUB Wipe (top%, bottom%, lft%, rght%, back%)
  75.  
  76. '----------------------------------------------------------------------------
  77. ' DECLARE statements for routines local to this program
  78. '----------------------------------------------------------------------------
  79. DECLARE FUNCTION Pause% (delay!)
  80. DECLARE SUB BannerDemo ()
  81. DECLARE SUB BlockDemo ()
  82. DECLARE SUB BuildScreenDemo ()
  83. DECLARE SUB CenterOffCenterDemo ()
  84. DECLARE SUB ClosingScreen ()
  85. DECLARE SUB ClrScrDemo ()
  86. DECLARE SUB GetFgBgDemo ()
  87. DECLARE SUB GetPutScreenInfo ()
  88. DECLARE SUB Initialize ()
  89. DECLARE SUB KeyPause ()
  90. DECLARE SUB MenuScreen ()
  91. DECLARE SUB MakeMenuInfo ()
  92. DECLARE SUB MakeWindowDemo ()
  93. DECLARE SUB MovingMessage ()
  94. DECLARE SUB MultiMenuDemo ()
  95. DECLARE SUB OpenScreen ()
  96. DECLARE SUB PointerBox (row%, col%)
  97. DECLARE SUB ScreenBlankDemo ()
  98. DECLARE SUB ScreenInfo ()
  99. DECLARE SUB WipeDemo ()
  100.  
  101. '----------------------------------------------------------------------------
  102. ' The whole of the module-level program...
  103. '----------------------------------------------------------------------------
  104.  
  105.     Initialize
  106.     OpenScreen
  107.     MenuScreen
  108.     ClosingScreen
  109.  
  110. '----------------------------------------------------------------------------
  111. '                                The END
  112. '----------------------------------------------------------------------------
  113.  
  114. SUB BannerDemo
  115.  
  116.     ' Set the colors for "Quit" at the bottom of the screen.  Make it blink.
  117.     IF kolor% THEN
  118.         COLOR BLINK + BRIGHT + RED, BLACK
  119.     ELSE
  120.         COLOR BLINK + BRIGHT + WHITE, BLACK
  121.     END IF
  122.  
  123.     Center "Quit ∙ ESC", 21
  124.  
  125.     ' Set colors for the banner itself
  126.     IF kolor% THEN
  127.         COLOR BRIGHT + RED, BLACK
  128.     ELSE
  129.         COLOR BRIGHT + WHITE, BLACK
  130.     END IF
  131.  
  132.     st$ = "  The QBSCR Screen Routines Demonstration!  "
  133.     k$ = ""
  134.    
  135.     ' Let the banner scroll until the user hits a key
  136.     done% = FALSE
  137.     DO
  138.         k$ = INKEY$
  139.         IF k$ <> "" THEN
  140.             done% = TRUE
  141.         ELSE
  142.             Banner st$, 3
  143.         END IF
  144.     LOOP UNTIL done%
  145.  
  146. END SUB
  147.  
  148. SUB BlockDemo
  149.  
  150.     ' Define colors for this demo
  151.     IF kolor% THEN
  152.         infoFG% = BRIGHT + CYAN: infoBG% = RED
  153.         blockFG% = RED: blockBG% = CYAN
  154.     ELSE
  155.         infoFG% = BLACK: infoBG% = WHITE
  156.         blockFG% = BLACK: blockBG% = WHITE
  157.     END IF
  158.  
  159.     ' Make the window explaining what's going on
  160.     MakeWindow 7, 36, 22, 75, infoFG%, infoBG%, 0, 1, 16, 1, " Block Save/Restore "
  161.     OffCenter "Using the Block Save and Restore", 9, 35, 75
  162.     OffCenter "routines is easy.  Simply Save a", 10, 35, 75
  163.     OffCenter "portion of the screen with Block", 11, 35, 75
  164.     OffCenter "Save, write overtop of that area", 12, 35, 75
  165.     OffCenter "and then restore the area with", 13, 35, 75
  166.     OffCenter "the Block Restore routine.", 14, 35, 75
  167.     OffCenter "In the example at the left, this", 16, 35, 75
  168.     OffCenter "is being done repeatedly to", 17, 35, 75
  169.     OffCenter "achieve the movement effect.", 18, 35, 75
  170.     OffCenter "Hit any key when you are done.", 20, 35, 75
  171.  
  172.     ' DIMensions a couple arrays to save screen information
  173.     DIM blockArray%(BlockSize%(10, 25, 15, 19))
  174.     DIM winArray%(BlockSize%(10, 25, 15, 19))
  175.  
  176.     ' Perform initial save of screen block
  177.     l% = 10: r% = 25: t% = 15: b% = 19
  178.     BlockSave l%, r%, t%, b%, blockArray%(), GetVideoSegment
  179.    
  180.     ' Make the window to move
  181.     MakeWindow 15, 10, 19, 25, blockFG%, blockBG%, 0, 1, -1, 0, ""
  182.     OffCenter "A", 16, 10, 25
  183.     OffCenter "Moving", 17, 10, 25
  184.     OffCenter "Window", 18, 10, 25
  185.     BlockSave l%, r%, t%, b%, winArray%(), GetVideoSegment
  186.  
  187.     ' Sit in a loop performing the animation until user hits a key
  188.     done% = FALSE
  189.     stage% = 0    ' Stage = 0 : window moves up
  190.                   ' Stage = 1 : window moves right
  191.                   ' Stage = 2 : window moves down and left
  192.     intraDelay = 100
  193.    
  194.     DO
  195.         SELECT CASE stage%
  196.         CASE 0    ' window moves up
  197.  
  198.             FOR x% = 14 TO 5 STEP -1
  199.  
  200.                 ' Pause the movement.  If key hit, then exit
  201.                 i% = Pause%(intraDelay)
  202.                 IF NOT (i%) THEN
  203.                     done% = TRUE
  204.                     EXIT FOR
  205.                 END IF
  206.  
  207.                 ' Step 1 in animation - restore old saved area
  208.                 BlockRestore l%, r%, t%, b%, blockArray%(), GetVideoSegment
  209.  
  210.                 ' Step 2 - increment counters and save new area
  211.                 t% = t% - 1
  212.                 b% = b% - 1
  213.                 BlockSave l%, r%, t%, b%, blockArray%(), GetVideoSegment
  214.  
  215.                 ' Step 3 - restore the window in blockArray()
  216.                 BlockRestore l%, r%, t%, b%, winArray%(), GetVideoSegment
  217.  
  218.             NEXT x%
  219.  
  220.             ' Step 4 - update the stage indicator
  221.             stage% = 1
  222.  
  223.         CASE 1   ' window moves right
  224.  
  225.             FOR x% = 12 TO 30 STEP 2
  226.  
  227.                 ' Pause the movement.  If key hit, then exit
  228.                 i% = Pause%(intraDelay)
  229.                 IF NOT (i%) THEN
  230.                     done% = TRUE
  231.                     EXIT FOR
  232.                 END IF
  233.  
  234.                 ' Step 1 in animation - restore old saved area
  235.                 BlockRestore l%, r%, t%, b%, blockArray%(), GetVideoSegment
  236.  
  237.                 ' Step 2 - increment counters and save new area
  238.                 l% = l% + 2
  239.                 r% = r% + 2
  240.                 BlockSave l%, r%, t%, b%, blockArray%(), GetVideoSegment
  241.  
  242.                 ' Step 3 - restore the window in blockArray()
  243.                 BlockRestore l%, r%, t%, b%, winArray%(), GetVideoSegment
  244.  
  245.             NEXT x%
  246.  
  247.             ' Step 4 - update the stage indicator
  248.             stage% = 2
  249.  
  250.         CASE 2   ' window move down and left
  251.    
  252.             FOR x% = 6 TO 15
  253.  
  254.                 ' Pause the movement.  If key hit, then exit
  255.                 i% = Pause%(intraDelay)
  256.                 IF NOT (i%) THEN
  257.                     done% = TRUE
  258.                     EXIT FOR
  259.                 END IF
  260.  
  261.                 ' Step 1 in animation - restore old saved area
  262.                 BlockRestore l%, r%, t%, b%, blockArray%(), GetVideoSegment
  263.  
  264.                 ' Step 2 - increment counters and save new area
  265.                 t% = t% + 1
  266.                 b% = b% + 1
  267.                 l% = l% - 2
  268.                 r% = r% - 2
  269.                 BlockSave l%, r%, t%, b%, blockArray%(), GetVideoSegment
  270.  
  271.                 ' Step 3 - restore the window in blockArray()
  272.                 BlockRestore l%, r%, t%, b%, winArray%(), GetVideoSegment
  273.                
  274.             NEXT x%
  275.  
  276.             ' Step 4 - update the stage indicator
  277.             stage% = 0
  278.  
  279.         END SELECT
  280.  
  281.         ' Check for user keypress
  282.         IF INKEY$ <> "" THEN
  283.             done% = TRUE
  284.         END IF
  285.    
  286.     LOOP UNTIL done%
  287.  
  288. END SUB
  289.  
  290. SUB BuildScreenDemo
  291.  
  292.     ' Determine colors for this portion of the demo
  293.     IF kolor% THEN
  294.         winFG% = YELLOW: winBG% = GREEN
  295.         file$ = "DEMO_C.CLR"
  296.     ELSE
  297.         winFG% = BLACK: winBG% = WHITE
  298.         file$ = "DEMO_C.MON"
  299.     END IF
  300.     entryFG% = BRIGHT + WHITE: entryBG% = BLACK
  301.  
  302.     ' Make a window with instructions
  303.     MakeWindow 9, 16, 18, 65, winFG%, winBG%, 0, 1, 16, 1, " BuildScreen Demonstration "
  304.     Center "The QBSCR BuildScreen routine will display a", 11
  305.     Center "screen using any of 16 fascinating methods.", 12
  306.     Center "Enter a BuildScreen mode below (0 - 15):", 14
  307.   
  308.     ' Get the user's response - loop until in valid range
  309.     DO
  310.         mode% = VAL(GetString$(39, 16, 2, entryFG%, entryBG%))
  311.     LOOP UNTIL (mode% >= 0) AND (mode% <= 15)
  312.   
  313.     ' Clear the screen using the user-entered mode
  314.     BuildScreen file$, mode%
  315.  
  316.     ' Wait for user to hit a key
  317.     KeyPause
  318.  
  319. END SUB
  320.  
  321. SUB CenterOffCenterDemo
  322.  
  323.     ' Initialize a few variables for this demo routine
  324.     minLeft% = 3: maxLeft% = 65
  325.     minRight% = 16: maxRight% = 78
  326.     leftPos% = minLeft%
  327.     rightPos% = maxRight%
  328.     leftEnd$ = CHR$(16)
  329.     rightEnd$ = CHR$(17)
  330.     sampleString$ = "Some Sample Text"
  331.  
  332.     ' Set up the screen for this demo
  333.     IF kolor% THEN
  334.         winFG% = BRIGHT + WHITE: winBG% = BLUE
  335.         textFG% = YELLOW: textBG% = BLACK
  336.         COLOR BRIGHT + BLUE, BLACK
  337.     ELSE
  338.         winFG% = BLACK: winBG% = WHITE
  339.         textFG% = BRIGHT + WHITE: textBG% = BLACK
  340.         COLOR BRIGHT + WHITE, BLACK
  341.     END IF
  342.     CLS
  343.     Center "═══ Center / OffCenter Demonstration ═══", 2
  344.     COLOR textFG%, textBG%
  345.     Center "This portion of the program will demonstrate the use of the Center and", 10
  346.     Center "OffCenter routines.  These lines were centered with the Center routine", 11
  347.     Center "which will center a string with respect to the entire screen.", 12
  348.     Center "OffCenter will center text between any two specified points on the", 14
  349.     Center "screen.  In the window above, the two symbols  and  represent", 15
  350.     Center "the points between which text will be centered.  Use the < and > keys", 16
  351.     Center "(, and .) to move the RIGHT endpoint left and right, and the X and C keys", 17
  352.     Center "to move the LEFT endpoint left and right.  The string " + CHR$(34) + "Some Sample Text" + CHR$(34), 18
  353.     Center "will be centered with the OffCenter routine between the endpoints each", 19
  354.     Center "time you move them.  To quit this demo and return to the menu, hit the", 20
  355.     Center "ESC key.", 21
  356.     MakeWindow 5, 1, 7, 80, winFG%, winBG%, 0, 1, -1, 2, ""
  357.     LOCATE 6, leftPos%, 0: PRINT leftEnd$;
  358.     LOCATE 6, rightPos%, 0: PRINT rightEnd$;
  359.     OffCenter sampleString$, 6, leftPos%, rightPos%
  360.  
  361.     ' Sit in a loop reading keys from the user.  Exit when ESC is hit
  362.     done% = FALSE
  363.     DO
  364.         ' Get a keystroke
  365.         k$ = UCASE$(INPUT$(1))
  366.  
  367.         ' Calculate new position boundaries, so the endpoints won't go
  368.         ' overtop of the sample text
  369.         leftBound% = rightPos% - LEN(sampleString$) - 1
  370.         rightBound% = leftPos% + LEN(sampleString$) + 1
  371.  
  372.         ' Update the endpoint positions or quit, based on user keystroke
  373.         SELECT CASE k$
  374.         CASE ","   ' Right endpoint moves left
  375.             IF (rightPos% > minRight%) AND (rightPos% > rightBound%) THEN
  376.                 rightPos% = rightPos% - 1
  377.             END IF
  378.         CASE "."   ' Right endpoint moves right
  379.             IF rightPos% < maxRight% THEN
  380.                 rightPos% = rightPos% + 1
  381.             END IF
  382.         CASE "C"   ' Left endpoint moves right
  383.             IF (leftPos% < maxLeft%) AND (leftPos% < leftBound%) THEN
  384.                 leftPos% = leftPos% + 1
  385.             END IF
  386.         CASE "X"   ' Left endpoint moves left
  387.             IF leftPos% > minLeft% THEN
  388.                 leftPos% = leftPos% - 1
  389.             END IF
  390.         CASE CHR$(27)   ' The ESC key - quit this portion of the demo
  391.             done% = TRUE
  392.         CASE ELSE
  393.         END SELECT
  394.  
  395.         ' Update the window contents (string and endpoints) based on new
  396.         ' values of the endpoints...but only if we're NOT done here
  397.         IF NOT (done%) THEN
  398.             LOCATE 6, 2, 0             ' Clear out the window
  399.             PRINT SPACE$(78);
  400.             LOCATE 6, leftPos%, 0      ' Draw in the left endpoint
  401.             PRINT leftEnd$;
  402.             LOCATE 6, rightPos%, 0     ' Draw in the right endpoint
  403.             PRINT rightEnd$;
  404.             OffCenter sampleString$, 6, leftPos%, rightPos%
  405.         END IF
  406.  
  407.     LOOP UNTIL done%
  408.  
  409. END SUB
  410.  
  411. SUB ClosingScreen
  412.  
  413.     ' Place the closing screen on the display.
  414.     IF kolor% THEN
  415.         BuildScreen "DEMO_A.CLR", 14
  416.     ELSE
  417.         BuildScreen "DEMO_A.MON", 14
  418.     END IF
  419.    
  420.     ' Make sure the colors are set properly, and the cursor is out of the
  421.     ' way.  And we're finished!
  422.     COLOR 7, 0
  423.     LOCATE 23, 1, 1
  424.  
  425. END SUB
  426.  
  427. SUB ClrScrDemo
  428.  
  429.     ' Determine colors for this portion of the demo
  430.     IF kolor% THEN
  431.         winFG% = BRIGHT + CYAN: winBG% = MAGENTA
  432.     ELSE
  433.         winFG% = BLACK: winBG% = WHITE
  434.     END IF
  435.     entryFG% = BRIGHT + WHITE: entryBG% = BLACK
  436.  
  437.     ' Make a window with instructions
  438.     MakeWindow 9, 16, 18, 65, winFG%, winBG%, 0, 1, 16, 1, " ClrScr Demonstration "
  439.     Center "The QBSCR ClrScr routine will clear the screen", 11
  440.     Center "using any of 16 fascinating methods.", 12
  441.     Center "Enter a ClrScr mode below (0 - 15):", 14
  442.    
  443.     ' Get the user's response - loop until in valid range
  444.     DO
  445.         mode% = VAL(GetString$(39, 16, 2, entryFG%, entryBG%))
  446.     LOOP UNTIL (mode% >= 0) AND (mode% <= 15)
  447.    
  448.     ' Clear the screen using the user-entered mode
  449.     ClrScr mode%, " "
  450.  
  451.     ' Tell user to hit a key
  452.     LOCATE 25, 1, 0: PRINT "Hit a key...";
  453.     KeyPause
  454.  
  455. END SUB
  456.  
  457. SUB GetFgBgDemo
  458.  
  459.     ' Define a few values for this routine
  460.     upArrow$ = CHR$(0) + CHR$(72)
  461.     downArrow$ = CHR$(0) + CHR$(80)
  462.     leftArrow$ = CHR$(0) + CHR$(75)
  463.     rightArrow$ = CHR$(0) + CHR$(77)
  464.  
  465.     ' Set up colors for this portion of the demo
  466.     IF kolor% THEN
  467.         winFG% = BRIGHT + WHITE: winBG% = BLUE
  468.         pointerFG% = YELLOW: pointerBG% = BLACK
  469.     ELSE
  470.         winFG% = BLACK: winBG% = WHITE
  471.         pointerFG% = BRIGHT + WHITE: pointerBG% = BLACK
  472.     END IF
  473.  
  474.     ' Load the pre-made screen that will serve as a background
  475.     ' for this demonstration
  476.     IF kolor% THEN
  477.         PutScreen "DEMO_B.CLR"
  478.     ELSE
  479.         PutScreen "DEMO_B.MON"
  480.     END IF
  481.  
  482.     ' Make the window and add instructional text
  483.     MakeWindow 16, 1, 25, 80, winFG%, winBG%, 0, 1, -1, 0, " GetForeground ∙ GetBackground "
  484.     Center "This pair of functions will return the foreground or background color of", 18
  485.     Center "any location on the screen.  For this demo, use the arrow keys to move the ", 19
  486.     Center "small box around the screen.  The foreground and background colors of", 20
  487.     Center "the character cell inside the box will be shown below.  To quit, hit ESC.", 21
  488.  
  489.     ' Save the area of the screen where the pointer box will be
  490.     DIM pointerArray%(BlockSize%(39, 41, 12, 14))
  491.     BlockSave 39, 41, 12, 14, pointerArray%(), GetVideoSegment
  492.  
  493.     ' Draw in the pointer box
  494.     COLOR pointerFG%, pointerBG%
  495.     pointerRow% = 12
  496.     pointerCol% = 39
  497.     PointerBox pointerRow%, pointerCol%
  498.  
  499.     ' Update the Foreground/Background color indicators
  500.     COLOR winFG%, winBG%
  501.     Center SPACE$(78), 23
  502.     Center "Foreground:" + STR$(GetForeground(pointerRow% + 1, pointerCol% + 1)) + "  Background:" + STR$(GetBackground(pointerRow% + 1, pointerCol% + 1)), 23
  503.  
  504.     ' Now we're all set to let the user do their thing.  Sit in a loop
  505.     ' and read keystrokes
  506.     done% = FALSE
  507.     DO
  508.         ' Get a keystroke
  509.         k$ = ""
  510.         DO
  511.             k$ = INKEY$
  512.         LOOP UNTIL k$ <> ""
  513.  
  514.         ' Save the current box location for restore
  515.         oldPointerRow% = pointerRow%
  516.         oldPointerCol% = pointerCol%
  517.  
  518.         ' Update our internal (logical) pointer box position based on the
  519.         ' user keystroke; or quit, if ESC was hit
  520.         SELECT CASE k$
  521.         CASE upArrow$
  522.             IF pointerRow% > 1 THEN
  523.                 pointerRow% = pointerRow% - 1
  524.             ELSE
  525.                 pointerRow% = 13
  526.             END IF
  527.         CASE downArrow$
  528.             IF pointerRow% < 13 THEN
  529.                 pointerRow% = pointerRow% + 1
  530.             ELSE
  531.                 pointerRow% = 1
  532.             END IF
  533.         CASE leftArrow$
  534.             IF pointerCol% > 1 THEN
  535.                 pointerCol% = pointerCol% - 1
  536.             ELSE
  537.                 pointerCol% = 78
  538.             END IF
  539.         CASE rightArrow$
  540.             IF pointerCol% < 78 THEN
  541.                 pointerCol% = pointerCol% + 1
  542.             ELSE
  543.                 pointerCol% = 1
  544.             END IF
  545.         CASE CHR$(27)    ' The ESC character - QUIT this demo
  546.             done% = TRUE
  547.         CASE ELSE
  548.         END SELECT
  549.  
  550.         IF NOT (done%) THEN
  551.            
  552.             ' Update the pointer box position
  553.             BlockRestore oldPointerCol%, oldPointerCol% + 2, oldPointerRow%, oldPointerRow% + 2, pointerArray%(), GetVideoSegment
  554.             BlockSave pointerCol%, pointerCol% + 2, pointerRow%, pointerRow% + 2, pointerArray%(), GetVideoSegment
  555.             COLOR pointerFG%, pointerBG%
  556.             PointerBox pointerRow%, pointerCol%
  557.  
  558.             ' Update the Foreground/Background color indicators
  559.             COLOR winFG%, winBG%
  560.             Center SPACE$(78), 23
  561.             Center "Foreground:" + STR$(GetForeground(pointerRow% + 1, pointerCol% + 1)) + "  Background:" + STR$(GetBackground(pointerRow% + 1, pointerCol% + 1)), 23
  562.            
  563.         END IF
  564.  
  565.     LOOP UNTIL done%
  566.  
  567. END SUB
  568.  
  569. SUB GetPutScreenInfo
  570.  
  571.     ' Set up colors for this function
  572.     IF kolor% THEN
  573.         fg% = WHITE: bg% = BLUE
  574.     ELSE
  575.         fg% = BLACK: bg% = WHITE
  576.     END IF
  577.  
  578.     ' Make a window to hold the info
  579.     MakeWindow 4, 11, 19, 70, fg%, bg%, 0, 1, 16, 1, " GetScreen and PutScreen Info "
  580.  
  581.     ' Add text to window explaining the Get/PutScreen functions
  582.     Center "The QBSCR PutScreen routine will load a premade screen", 6
  583.     Center "(generated using Screen Builder) from disk and display", 7
  584.     Center "it on the monitor.  This is very fast.  From a fixed", 8
  585.     Center "disk, the time to the display is less than 1 second!", 9
  586.     Center "Many of the displays in this demo, including the", 10
  587.     Center "opening screen and the menu, were generated with", 11
  588.     Center "Screen Builder and displayed with PutScreen.", 12
  589.    
  590.     Center "GetScreen peforms the opposite service.  It will get", 14
  591.     Center "a copy of the display and save it to disk very", 15
  592.     Center "quickly.  GetScreen is the heart of the SAVE", 16
  593.     Center "function in Screen Builder.", 17
  594.  
  595.     Center " Hit any key to continue ", 19
  596.    
  597.     ' Wait for user to hit a key before exiting
  598.     KeyPause
  599.  
  600. END SUB
  601.  
  602. SUB Initialize
  603.  
  604.     IF ColorChk THEN
  605.         kolor% = TRUE
  606.     ELSE
  607.         kolor% = FALSE
  608.     END IF
  609.  
  610. END SUB
  611.  
  612. SUB KeyPause
  613.  
  614.     kee$ = INPUT$(1)
  615.  
  616. END SUB
  617.  
  618. SUB MakeMenuInfo
  619.  
  620.     ' Set up colors for this function
  621.     IF kolor% THEN
  622.         fg% = BRIGHT + WHITE: bg% = RED
  623.     ELSE
  624.         fg% = BLACK: bg% = WHITE
  625.     END IF
  626.  
  627.     ' Make a window to hold the info
  628.     MakeWindow 2, 11, 22, 70, fg%, bg%, 0, 1, 16, 1, " MakeMenu Info "
  629.  
  630.     ' Add text to window
  631.     Center "The main menu for this demo, the one you've been", 4
  632.     Center "selecting options from, is the result of the QBSCR", 5
  633.     Center "MakeMenu routine.", 6
  634.     Center "This routine is a function, and returns the user's", 8
  635.     Center "selection by number.  For instance, if your user", 9
  636.     Center "had chosen the third selection, MakeMenu would", 10
  637.     Center "return a value of 3.", 11
  638.     Center "Make menu includes the use of " + CHR$(34) + "Quick Access" + CHR$(34) + " keys.", 13
  639.     Center "Each entry has a unique letter associated with it,", 14
  640.     Center "highlighted on the screen, that may be used for", 15
  641.     Center "direct access to that menu selection.", 16
  642.     Center "MakeMenu can center or right or left justify your", 18
  643.     Center "menu entries, has a wrapping selection bar, and can", 19
  644.     Center "make your programs simple to use.", 20
  645.     Center " Hit any key to continue ", 22
  646.  
  647.     ' Wait for the user to hit a key
  648.     KeyPause
  649.  
  650. END SUB
  651.  
  652. SUB MakeWindowDemo
  653.  
  654.     ' Set up some variables for the five demo windows
  655.     DIM windowFG%(1 TO 5)
  656.     DIM windowBG%(1 TO 5)
  657.     winDelay = 750
  658.  
  659.     ' Set up 5 arrays to save the screen between each window. This could be
  660.     ' done much more efficiently memory-wise by using BlockSave and
  661.     ' BlockRestore, since they require only an array the size of the area
  662.     ' to be saved.  I'm just feeling lazy right now, as all programmers will.
  663.     DIM scrArray1%(4000)
  664.     DIM scrArray2%(4000)
  665.     DIM scrArray3%(4000)
  666.     DIM scrArray4%(4000)
  667.     DIM scrArray5%(4000)
  668.  
  669.     ' Set colors for windows
  670.     IF kolor% THEN
  671.         windowFG%(1) = BRIGHT + WHITE: windowBG%(1) = BLUE
  672.         windowFG%(2) = BLUE: windowBG%(2) = CYAN
  673.         windowFG%(3) = YELLOW: windowBG%(3) = RED
  674.         windowFG%(4) = BRIGHT + WHITE: windowBG%(4) = GREEN
  675.         windowFG%(5) = BRIGHT + CYAN: windowBG%(5) = MAGENTA
  676.     ELSE
  677.         windowFG%(1) = BRIGHT + WHITE: windowBG%(1) = BLACK
  678.         windowFG%(2) = BLACK: windowBG%(2) = WHITE
  679.         windowFG%(3) = WHITE: windowBG%(3) = BLACK
  680.         windowFG%(4) = BLACK: windowBG%(4) = WHITE
  681.         windowFG%(5) = BRIGHT + WHITE: windowBG%(5) = BLACK
  682.     END IF
  683.  
  684.     ' First Window
  685.     ScrnSave 1, 25, scrArray1%(), GetVideoSegment
  686.     PLAY "MB L64 N1 N10 N20 N30 N40 N50 N60 N70 N80"
  687.     MakeWindow 1, 5, 10, 30, windowFG%(1), windowBG%(1), 0, 1, 16, 1, " First Window "
  688.     x% = Pause(winDelay)
  689.    
  690.     ' Second Window
  691.     ScrnSave 1, 25, scrArray2%(), GetVideoSegment
  692.     PLAY "MB L64 N1 N10 N20 N30 N40 N50 N60 N70 N80"
  693.     MakeWindow 2, 38, 8, 68, windowFG%(2), windowBG%(2), 4, 0, 16, 1, " Second Window "
  694.     x% = Pause(winDelay)
  695.  
  696.     ' Third Window
  697.     ScrnSave 1, 25, scrArray3%(), GetVideoSegment
  698.     PLAY "MB L64 N1 N10 N20 N30 N40 N50 N60 N70 N80"
  699.     MakeWindow 11, 40, 22, 75, windowFG%(3), windowBG%(3), 7, 2, 16, 1, " Third Window "
  700.     x% = Pause(winDelay)
  701.  
  702.     ' Fourth Window
  703.     ScrnSave 1, 25, scrArray4%(), GetVideoSegment
  704.     PLAY "MB L64 N1 N10 N20 N30 N40 N50 N60 N70 N80"
  705.     MakeWindow 13, 3, 21, 34, windowFG%(4), windowBG%(4), 5, 3, 16, 1, " Fourth Window "
  706.     x% = Pause(winDelay)
  707.  
  708.     ' Fifth Window
  709.     ScrnSave 1, 25, scrArray5%(), GetVideoSegment
  710.     PLAY "MB L64 N1 N10 N20 N30 N40 N50 N60 N70 N80"
  711.     MakeWindow 7, 16, 18, 65, windowFG%(5), windowBG%(5), 0, 1, 16, 1, " Fifth Window "
  712.  
  713.     ' Add text to fifth window
  714.     Center "These windows were all generated with the", 9
  715.     Center "QBSCR MakeWindow routine. At your", 10
  716.     Center "disposal are ten types of windows, six", 11
  717.     Center "types of window frames, 17 kinds of", 12
  718.     Center "window shadows, four modes of placing", 13
  719.     Center "windows on the screen, and much more.", 14
  720.     Center "Hit any key to continue", 16
  721.  
  722.     ' Wait for user to press a key
  723.     KeyPause
  724.    
  725.     ' Make a noise and remove each window in turn
  726.     PLAY "MB L16 N10"
  727.     ScrnRestore 1, 25, scrArray5%(), GetVideoSegment: x% = Pause%(winDelay)
  728.     PLAY "MB L16 N10"
  729.     ScrnRestore 1, 25, scrArray4%(), GetVideoSegment: x% = Pause%(winDelay)
  730.     PLAY "MB L16 N10"
  731.     ScrnRestore 1, 25, scrArray3%(), GetVideoSegment: x% = Pause%(winDelay)
  732.     PLAY "MB L16 N10"
  733.     ScrnRestore 1, 25, scrArray2%(), GetVideoSegment: x% = Pause%(winDelay)
  734.     PLAY "MB L16 N10"
  735.     ScrnRestore 1, 25, scrArray1%(), GetVideoSegment
  736.  
  737. END SUB
  738.  
  739. SUB MenuScreen
  740.  
  741.     ' Define menu screen file name and set colors for menu
  742.     IF kolor% THEN
  743.         scrFile$ = "MENU.CLR"
  744.         fg% = CYAN: bg% = BLACK
  745.         hfg% = YELLOW: hbg% = CYAN
  746.         qfg% = BRIGHT + WHITE: qbg% = BLACK
  747.         COLOR BLUE, BLACK
  748.     ELSE
  749.         scrFile$ = "MENU.MON"
  750.         fg% = WHITE: bg% = BLACK
  751.         hfg% = BLACK: hbg% = WHITE
  752.         qfg% = BRIGHT + WHITE: qbg% = BLACK
  753.         COLOR WHITE, BLACK
  754.     END IF
  755.  
  756.     ' Define menu array for MakeMenu call
  757.     DIM menu$(maxEntries)
  758.         menu$(1) = "^Banner"
  759.         menu$(2) = "Build^Screen"
  760.         menu$(3) = "Center/OffCe^nter"
  761.         menu$(4) = "^ClrScr"
  762.         menu$(5) = "^Foreground or Background"
  763.         menu$(6) = "^GetScreen/PutScreen Info"
  764.         menu$(7) = "^MakeMenu Info"
  765.         menu$(8) = "Make^Window"
  766.         menu$(9) = "M^ultiMenu"
  767.         menu$(10) = "Save/Restore Sc^reen"
  768.         menu$(11) = "Save/Restore B^lock"
  769.         menu$(12) = "ScreenBlan^k"
  770.         menu$(13) = "Wi^pe"
  771.  
  772.     ' Place the menu screen on the display, in a very nifty fashion
  773.     ClrScr 3, CHR$(176)
  774.     BuildScreen scrFile$, 2
  775.  
  776.     ' Save the screen for fast restore later
  777.     DIM scrArray%(4000)
  778.     ScrnSave 1, 25, scrArray%(), GetVideoSegment
  779.  
  780.     ' We'll sit in a loop until the user is done pushing keys
  781.     done% = FALSE
  782.     DO
  783.         ' Make the menu first of all
  784.         choice% = MakeMenu%(menu$(), maxEntries, "C", 29, 53, 7, "^", fg%, bg%, hfg%, hbg%, qfg%, qbg%)
  785.  
  786.         ' Decide what to do based on the user's selection
  787.         SELECT CASE choice%
  788.         CASE 0    ' The ESC key was hit - MakeMenu exits with 0
  789.             done% = TRUE
  790.         CASE 1    ' Banner
  791.             BannerDemo
  792.         CASE 2    ' BuildScreen
  793.             BuildScreenDemo
  794.         CASE 3    ' Center/OffCenter
  795.             CenterOffCenterDemo
  796.         CASE 4    ' ClrScr
  797.             ClrScrDemo
  798.         CASE 5    ' Get Foreground/Background
  799.             GetFgBgDemo
  800.         CASE 6    ' GetScreen/PutScreen Info
  801.             GetPutScreenInfo
  802.         CASE 7    ' MakeMenu Info
  803.             MakeMenuInfo
  804.         CASE 8    ' MakeWindow
  805.             MakeWindowDemo
  806.         CASE 9    ' MultiMenu
  807.             MultiMenuDemo
  808.         CASE 10   ' Save/Restore Screen
  809.             ScreenInfo
  810.         CASE 11   ' Save/Restore Block
  811.             BlockDemo
  812.         CASE 12   ' ScreenBlank
  813.             ScreenBlankDemo
  814.         CASE 13   ' Wipe
  815.             WipeDemo
  816.         CASE ELSE
  817.         END SELECT
  818.  
  819.         ' Restore the screen after selected demo returns
  820.         IF NOT (done%) THEN
  821.             ScrnRestore 1, 25, scrArray%(), GetVideoSegment
  822.         END IF
  823.  
  824.     LOOP UNTIL done%
  825.  
  826. END SUB
  827.  
  828. SUB MovingMessage
  829.  
  830.     ' A few local vars
  831.     bigPause = 750
  832.     littlePause = 35
  833.  
  834.     ' Setup our scrnsave arrays
  835.     DIM under%(BlockSize%(34, 46, 19, 19))
  836.     DIM over%(BlockSize%(34, 46, 19, 19))
  837.     segment = GetVideoSegment
  838.  
  839.     ' Set colors
  840.     IF kolor% THEN
  841.         COLOR 15, 4
  842.     ELSE
  843.         COLOR 0, 7
  844.     END IF
  845.  
  846.     ' Save portion of screen and make the initial message
  847.     BlockSave 34, 46, 19, 19, under%(), segment
  848.     LOCATE 19, 34, 0: PRINT " Hit any key ";
  849.     BlockSave 34, 46, 19, 19, over%(), segment
  850.     IF Pause%(bigPause) = FALSE THEN
  851.         EXIT SUB
  852.     END IF
  853.    
  854.     ' Move message to left side of screen
  855.     FOR x% = 34 TO 6 STEP -2
  856.         BlockRestore x%, x% + 12, 19, 19, over%(), segment
  857.         IF Pause%(littlePause) = FALSE THEN
  858.             EXIT SUB
  859.         END IF
  860.         BlockRestore x%, x% + 12, 19, 19, under%(), segment
  861.     NEXT x%
  862.     BlockRestore x%, x% + 12, 19, 19, over%(), segment
  863.     IF Pause%(bigPause) = FALSE THEN
  864.         EXIT SUB
  865.     END IF
  866.  
  867.     ' Sit in a loop that moves the message while waiting for a keypress
  868.     done% = FALSE
  869.     DO
  870.         ' Move up
  871.         FOR y% = 18 TO 4 STEP -1
  872.             BlockRestore 4, 16, y% + 1, y% + 1, under%(), segment
  873.             BlockSave 4, 16, y%, y%, under%(), segment
  874.             BlockRestore 4, 16, y%, y%, over%(), segment
  875.             IF Pause%(littlePause) = FALSE THEN
  876.                 EXIT SUB
  877.             END IF
  878.         NEXT y%
  879.         IF Pause%(bigPause) = FALSE THEN
  880.             EXIT SUB
  881.         END IF
  882.  
  883.         'Move right
  884.         FOR x% = 4 TO 64 STEP 2
  885.             BlockRestore x%, x% + 12, 4, 4, over%(), segment
  886.             IF Pause%(littlePause) = FALSE THEN
  887.                 EXIT SUB
  888.             END IF
  889.             BlockRestore x%, x% + 12, 4, 4, under%(), segment
  890.         NEXT x%
  891.         BlockRestore x%, x% + 12, 4, 4, over%(), segment
  892.         IF Pause%(bigPause) = FALSE THEN
  893.             EXIT SUB
  894.         END IF
  895.  
  896.         ' Move down
  897.         FOR y% = 5 TO 19
  898.             BlockRestore 66, 78, y% - 1, y% - 1, under%(), segment
  899.             BlockSave 66, 78, y%, y%, under%(), segment
  900.             BlockRestore 66, 78, y%, y%, over%(), segment
  901.             IF Pause%(littlePause) = FALSE THEN
  902.                 EXIT SUB
  903.             END IF
  904.         NEXT y%
  905.         IF Pause%(bigPause) = FALSE THEN
  906.             EXIT SUB
  907.         END IF
  908.  
  909.         ' Move left
  910.         FOR x% = 66 TO 6 STEP -2
  911.             BlockRestore x%, x% + 12, 19, 19, over%(), segment
  912.             IF Pause%(littlePause) = FALSE THEN
  913.                 EXIT SUB
  914.             END IF
  915.             BlockRestore x%, x% + 12, 19, 19, under%(), segment
  916.         NEXT x%
  917.         BlockRestore x%, x% + 12, 19, 19, over%(), segment
  918.         IF Pause%(bigPause) = FALSE THEN
  919.             EXIT SUB
  920.         END IF
  921.  
  922.     LOOP UNTIL done%
  923.   
  924. END SUB
  925.  
  926. SUB MultiMenuDemo
  927.  
  928.     ' Define a few constants for this routine
  929.     maxChoices% = 9
  930.     maxMenus% = 6
  931.     F10$ = CHR$(0) + CHR$(68)
  932.  
  933.     ' DIMension screen saving arrays
  934.     DIM scrArray%(4000)   ' For entire screen
  935.  
  936.     ' Set colors for MultiMenu demo
  937.     IF kolor% THEN
  938.         fg% = WHITE: bg% = BLUE
  939.         hfg% = YELLOW: hbg% = BLACK
  940.         qfg% = BRIGHT + WHITE: qbg% = BLUE
  941.         headerFG% = BRIGHT + WHITE: headerBG% = BLUE
  942.         rulerFG% = BRIGHT + MAGENTA: rulerBG% = BLACK
  943.         editFG% = BRIGHT + CYAN: editBG% = BLACK
  944.     ELSE
  945.         fg% = BLACK: bg% = WHITE
  946.         hfg% = BRIGHT + WHITE: hbg% = BLACK
  947.         qfg% = BRIGHT + WHITE: qbg% = BLACK
  948.         headerFG% = BRIGHT + WHITE: headerBG% = BLACK
  949.         rulerFG% = BLACK: rulerBG% = WHITE
  950.         editFG% = BRIGHT + WHITE: editBG% = BLACK
  951.     END IF
  952.  
  953.     ' DIMension and initialize arrays for MultiMenu
  954.     DIM menusArray$(1 TO maxMenus%, 1 TO maxChoices%)
  955.     DIM numEntries%(1 TO maxMenus%)
  956.     DIM menuTitles$(1 TO maxMenus%)
  957.  
  958.     ' Assign the menu titles
  959.     menuTitles$(1) = "^File"
  960.     menuTitles$(2) = "^Block"
  961.     menuTitles$(3) = "^Search"
  962.     menuTitles$(4) = "^Print"
  963.     menuTitles$(5) = "^Options"
  964.     menuTitles$(6) = "^Help"
  965.  
  966.     ' Choices for first menu, FILE
  967.     menusArray$(1, 1) = "^Load File"
  968.     menusArray$(1, 2) = "^Save File"
  969.     menusArray$(1, 3) = "Sa^ve File As"
  970.     menusArray$(1, 4) = "^Merge File"
  971.     menusArray$(1, 5) = "^Abandon File"
  972.     menusArray$(1, 6) = "^Directory"
  973.     menusArray$(1, 7) = "^Quit DummyEDIT"
  974.    
  975.     ' Choices for second menu, BLOCK
  976.     menusArray$(2, 1) = "^Begin Block"
  977.     menusArray$(2, 2) = "^End Block"
  978.     menusArray$(2, 3) = "^Unmark Block"
  979.     menusArray$(2, 4) = "^Move Block"
  980.     menusArray$(2, 5) = "^Delete Block"
  981.     menusArray$(2, 6) = "^Copy Block"
  982.     menusArray$(2, 7) = "^Print Block"
  983.     menusArray$(2, 8) = "^Write Block"
  984.     menusArray$(2, 9) = "^Spell Check"
  985.  
  986.     ' Choices for third menu, SEARCH
  987.     menusArray$(3, 1) = "^Find text"
  988.     menusArray$(3, 2) = "^Repeat Last Find"
  989.     menusArray$(3, 3) = "^Search and Replace"
  990.  
  991.     ' Choices for fourth menu, PRINT
  992.     menusArray$(4, 1) = "^Print Current File"
  993.     menusArray$(4, 2) = "Print From ^Disk"
  994.     menusArray$(4, 3) = "Print ^Options"
  995.     
  996.     ' Choices for fifth menu, OPTIONS
  997.     menusArray$(5, 1) = "^Colors"
  998.     menusArray$(5, 2) = "^Tab Settings"
  999.     menusArray$(5, 3) = "^Margin Settings"
  1000.     menusArray$(5, 4) = "^Page Length"
  1001.  
  1002.     ' Choices for sixth menu, HELP
  1003.     menusArray$(6, 1) = "^General Help"
  1004.     menusArray$(6, 2) = "Function ^Keys"
  1005.     menusArray$(6, 3) = "^Editing Help"
  1006.     menusArray$(6, 4) = "^File Help"
  1007.     menusArray$(6, 5) = "^Block Help"
  1008.     menusArray$(6, 6) = "^Search Help"
  1009.     menusArray$(6, 7) = "^Print Help"
  1010.     menusArray$(6, 8) = "^Options Help"
  1011.  
  1012.     ' Assign the actual number of entries in each menu
  1013.     numEntries%(1) = 7
  1014.     numEntries%(2) = 9
  1015.     numEntries%(3) = 3
  1016.     numEntries%(4) = 3
  1017.     numEntries%(5) = 4
  1018.     numEntries%(6) = 8
  1019.  
  1020.     ' Set up the fake edit display
  1021.     COLOR 7, 0
  1022.     CLS
  1023.     COLOR headerFG%, headerBG%
  1024.     LOCATE 1, 1, 0: PRINT SPACE$(80);
  1025.     Center "DummyEDIT  ■  Page: 1  Line: 10  Column: 5  Mode: INS  ■  For menu, hit F10", 1
  1026.     LOCATE 2, 1, 0: PRINT STRING$(80, 205);
  1027.     COLOR rulerFG%, rulerBG%
  1028.     PRINT "────L────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────R─────";
  1029.    
  1030.     ' Add the explanatory text, posing as a document being edited
  1031.     COLOR editFG%, editBG%
  1032.     LOCATE 5, 5, 0: PRINT "     Welcome to the demo for MultiMenu.  This routine will allow you to";
  1033.     LOCATE 6, 5, 0: PRINT "create  a pull-down menu system such as the one used in the  QuickBASIC";
  1034.     LOCATE 7, 5, 0: PRINT "environment.";
  1035.     LOCATE 9, 5, 0: PRINT "     This  demo will simulate a fictitious text editor, which  we  will";
  1036.     LOCATE 10, 5, 0: PRINT "call DummyEDIT.  No editing functions will be available, but the editor";
  1037.     LOCATE 11, 5, 0: PRINT "menu  system  will work.  This menu will be generated entirely  by  the";
  1038.     LOCATE 12, 5, 0: PRINT "QBSCR  MultiMenu routine.  When you select a menu operation, your entry";
  1039.     LOCATE 13, 5, 0: PRINT "will be echoed in a small window,  to show that MultiMenu is  returning";
  1040.     LOCATE 14, 5, 0: PRINT "values  based on your selection.   To clear the small window,  hit  any";
  1041.     LOCATE 15, 5, 0: PRINT "key.  To quit the demo, select Quit DummyEDIT from the File menu.";
  1042.     LOCATE 17, 5, 0: PRINT "     To get the menu, hit the F10 key.  This is just part of the editor";
  1043.     LOCATE 18, 5, 0: PRINT "simulator.   Once the menu is up,  you can use the left and right arrow";
  1044.     LOCATE 19, 5, 0: PRINT "keys or Home and End keys to move the highlight.  Use ENTER or the down";
  1045.     LOCATE 20, 5, 0: PRINT "arrow key to 'pull down' the menu.   Once the menu is visible,  you can";
  1046.     LOCATE 21, 5, 0: PRINT "use  the  up and down arrow keys and ENTER to select an entry,  or  the";
  1047.     LOCATE 22, 5, 0: PRINT "highlighted  'Quick Access' keys.   While the menu is visible,  you can";
  1048.     LOCATE 23, 5, 0: PRINT "use the left and right arrow keys to move to a new menu.";
  1049.     LOCATE 25, 5, 0: PRINT "     Remember, to quit this demo, select Quit from the File menu.";
  1050.  
  1051.     ' Prepare to unleash MultiMenu!
  1052.     ' Save entire screen, because I'm still feeling lazy
  1053.     ScrnSave 1, 25, scrArray%(), GetVideoSegment
  1054.  
  1055.     ' Sit in a loop while the user has not hit ESC.
  1056.     done% = FALSE
  1057.     DO
  1058.         k$ = ""
  1059.         DO
  1060.             k$ = INKEY$
  1061.         LOOP UNTIL k$ <> ""
  1062.         IF k$ = F10$ THEN
  1063.             MultiMenu menusArray$(), numEntries%(), menuTitles$(), "L", "^", 16, fg%, bg%, hfg%, hbg%, qfg%, qbg%, menuSelected%, menuEntrySelected%
  1064.             IF menuSelected% = 1 AND menuEntrySelected% = 7 THEN
  1065.                 done% = TRUE
  1066.             ELSE
  1067.                 ' Display window with user's choice
  1068.                 MakeWindow 15, 10, 17, 70, fg%, bg%, 0, 1, 16, 0, ""
  1069.                 Center "You selected item" + STR$(menuEntrySelected%) + " from menu" + STR$(menuSelected%) + "   (Hit any key)", 16
  1070.                 KeyPause
  1071.             END IF
  1072.             
  1073.             ' Restore the screen
  1074.             ScrnRestore 1, 25, scrArray%(), GetVideoSegment
  1075.         END IF
  1076.     LOOP UNTIL done%
  1077.  
  1078. END SUB
  1079.  
  1080. SUB OpenScreen
  1081.  
  1082.     ' Are we COLOR or MONO?
  1083.     IF kolor% THEN
  1084.         f$ = "DEMO.CLR"
  1085.     ELSE
  1086.         f$ = "DEMO.MON"
  1087.     END IF
  1088.  
  1089.     ' Load the proper opening screen
  1090.     PutScreen f$
  1091.  
  1092.     ' Make a moving "Hit any key" message
  1093.     MovingMessage
  1094.  
  1095. END SUB
  1096.  
  1097. FUNCTION Pause% (delay)
  1098.  
  1099.     ' Wait in a loop checking for a keystroke the whole time.  If a key
  1100.     ' is hit before the delay is used up, then set the return value to
  1101.     ' FALSE.  If the delay expires without a key being pressed, then
  1102.     ' return a value of TRUE.
  1103.     FOR x = 1 TO delay
  1104.         IF INKEY$ <> "" THEN
  1105.             Pause% = FALSE
  1106.             EXIT FUNCTION
  1107.         END IF
  1108.     NEXT x
  1109.     Pause% = TRUE
  1110.  
  1111. END FUNCTION
  1112.  
  1113. SUB PointerBox (row%, col%)
  1114.  
  1115.     ' This routine is used by the GetFgBgDemo routine only.
  1116.  
  1117.     ' Draw the pointer box with the upper-left corner at the
  1118.     ' row and column passed into this routine
  1119.     LOCATE row%, col%, 0
  1120.     PRINT "┌─┐";
  1121.     LOCATE row% + 1, col%, 0
  1122.     PRINT "│";
  1123.     LOCATE row% + 1, col% + 2, 0
  1124.     PRINT "│";
  1125.     LOCATE row% + 2, col%, 0
  1126.     PRINT "└─┘";
  1127.  
  1128. END SUB
  1129.  
  1130. SUB ScreenBlankDemo
  1131.  
  1132.     ' Set up colors for ScreenBlank Demo
  1133.     IF kolor% THEN
  1134.         winFG% = BRIGHT + WHITE: winBG% = BROWN
  1135.         entryFG% = YELLOW: entryBG% = BLACK
  1136.     ELSE
  1137.         winFG% = BLACK: winBG% = WHITE
  1138.         entryFG% = BRIGHT + WHITE: entryBG% = BLACK
  1139.     END IF
  1140.  
  1141.     ' Display a window with some info in it
  1142.     MakeWindow 5, 13, 20, 68, winFG%, winBG%, 0, 1, 16, 1, " ScreenBlank Demo "
  1143.     Center "The ScreenBlank function will provide you with a", 7
  1144.     Center "capable mechanism to spare your users from the", 8
  1145.     Center "woes of burn-in.  Provide ScreenBlank with a", 9
  1146.     Center "delay value, and the screen will be cleared.", 10
  1147.     Center "To inform your users of what's going on, a small", 11
  1148.     Center "message will be displayed telling them that they", 12
  1149.     Center "may hit a key to return to your program.  To", 13
  1150.     Center "prevent THAT message from burning into the", 14
  1151.     Center "screen, it bounces periodically.", 15
  1152.     Center "Enter a delay value below (>1000):", 17
  1153.  
  1154.     ' Get entry from user
  1155.     DO
  1156.         value = VAL(GetString$(38, 18, 5, entryFG%, entryBG%))
  1157.     LOOP UNTIL value > 999
  1158.  
  1159.     ' Perform the screen blank operation
  1160.     dummy$ = ScreenBlank$(value)
  1161.  
  1162. END SUB
  1163.  
  1164. SUB ScreenInfo
  1165.  
  1166.     ' Set up colors for this function
  1167.     IF kolor% THEN
  1168.         fg% = BLUE: bg% = CYAN
  1169.     ELSE
  1170.         fg% = BLACK: bg% = WHITE
  1171.     END IF
  1172.  
  1173.     ' Make a window to hold the info
  1174.     MakeWindow 2, 11, 23, 70, fg%, bg%, 0, 1, 16, 1, " Save/Restore Screen Info "
  1175.  
  1176.     ' Add text to window
  1177.     Center "This demo, by it's very nature, will show its", 4
  1178.     Center "capabilities when it closes, after you finish reading", 5
  1179.     Center "this screen of information.", 6
  1180.     Center "The ScrnSave and ScrnRestore routines allow you to", 8
  1181.     Center "give the appearance of popping items onto and off of", 9
  1182.     Center "the existing display.  This is done by first saving", 10
  1183.     Center "the contents of the current display using ScrnSave.", 11
  1184.     Center "This information is stored in an integer array.", 12
  1185.     Center "The second step is to display whatever you want", 13
  1186.     Center "on the existing display.  You could put a menu there,", 14
  1187.     Center "a window containing an error message, or anything,", 15
  1188.     Center "really.  It all depends on your needs.", 16
  1189.     Center "The last step, which takes place when you have", 17
  1190.     Center "finished with your window, menu etc., is to restore", 18
  1191.     Center "the screen using ScrnRestore.  Your original display", 19
  1192.     Center "is restored.  When you hit a key to exit this demo,", 20
  1193.     Center "the screen will be restored with ScrnRestore.", 21
  1194.  
  1195.     ' Wait for the user to hit a key
  1196.     KeyPause
  1197.  
  1198. END SUB
  1199.  
  1200. SUB WipeDemo
  1201.  
  1202.     ' Set colors for this demo
  1203.     IF kolor% THEN
  1204.         win1FG% = BRIGHT + WHITE: win1BG% = RED
  1205.         win2FG% = BRIGHT + WHITE: win2BG% = BLUE
  1206.     ELSE
  1207.         win1FG% = BLACK: win1BG% = WHITE
  1208.         win2FG% = BLACK: win2BG% = WHITE
  1209.     END IF
  1210.  
  1211.     ' Make 2 windows for this demo
  1212.     ' Window 1, with text...
  1213.     MakeWindow 2, 3, 20, 38, win1FG%, win1BG%, 0, 1, 16, 1, "Wipe Demo "
  1214.     OffCenter "Wipe will clear out a window", 4, 3, 38
  1215.     OffCenter "of all its contents, leaving", 5, 3, 38
  1216.     OffCenter "it empty and ready for reuse", 6, 3, 38
  1217.     OffCenter "by your program. You can use", 7, 3, 38
  1218.     OffCenter "Wipe to wipe any rectangular", 8, 3, 38
  1219.     OffCenter "area of the screen.", 9, 3, 38
  1220.     OffCenter "Wipe always clears out the", 11, 3, 38
  1221.     OffCenter "INSIDE area of the defined", 12, 3, 38
  1222.     OffCenter "area, so you can give it the", 13, 3, 38
  1223.     OffCenter "same coordinates you gave to", 14, 3, 38
  1224.     OffCenter "MakeWindow.", 15, 3, 38
  1225.     OffCenter "To see Wipe clear the window", 17, 3, 38
  1226.     OffCenter "to the right, hit any key...", 18, 3, 38
  1227.  
  1228.     ' ...and window number two.
  1229.     MakeWindow 5, 42, 18, 76, win2FG%, win2BG%, 0, 1, 16, 1, " Second Window "
  1230.     FOR x% = 6 TO 17
  1231.         LOCATE x%, 42 + (x% - 5), 0
  1232.         PRINT "Text about to be WIPEd";
  1233.     NEXT x%
  1234.  
  1235.     ' Wait for user to hit a key
  1236.     KeyPause
  1237.  
  1238.     ' WIPE window numer two
  1239.     Wipe 5, 18, 42, 76, win2BG%
  1240.  
  1241.     ' Wait for user to hit a key
  1242.     COLOR BLINK + win2FG%, win2BG%
  1243.     OffCenter " Hit any key to continue ", 18, 42, 76
  1244.     KeyPause
  1245.  
  1246. END SUB
  1247.  
  1248.