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

  1. '┌────────────────────────────────────────────────────────────────────────┐
  2. '│                                                                        │
  3. '│                             R E F . B A S                              │
  4. '│                                                                        │
  5. '│                   (C) Copyright 1989 by Tony Martin                    │
  6. '│                                                                        │
  7. '├────────────────────────────────────────────────────────────────────────┤
  8. '│                                                                        │
  9. '│  Author: Tony Martin                                                   │
  10. '│  Completion Date: September 1, 1989                                    │
  11. '│  Language: Microsoft QuickBASIC version 4.5                            │
  12. '│                                                                        │
  13. '├────────────────────────────────────────────────────────────────────────┤
  14. '│                                                                        │
  15. '│  The purpose of this program is to provide a computer-based reference  │
  16. '│  to the portions of the QBSCR Screen Routines that require frequent    │
  17. '│  lookups.  These section includes window types, frame types, explode   │
  18. '│  types, and clear screen modes.                                        │
  19. '│                                                                        │
  20. '├────────────────────────────────────────────────────────────────────────┤
  21. '│                                                                        │
  22. '│  Compile instructions:                                                 │
  23. '│                                                                        │
  24. '│  Load the file REF.BAS into QuickBASIC normally.  Then load in add-    │
  25. '│  ition the file QBSCR.BAS.  You can then save the whole deal so that   │
  26. '│  QuickBASIC will create an .MAK file for the program.  At this         │
  27. '│  point the program will run; either use Shift+F5 or compile to an      │
  28. '│  .EXE file.                                                            │
  29. '│                                                                        │
  30. '└────────────────────────────────────────────────────────────────────────┘
  31.  
  32. '┌────────────────────────────────────────────────────────────────────────┐
  33. '│  Load the necessary DECLARE statements for the QBSCR routines.         │
  34. '└────────────────────────────────────────────────────────────────────────┘
  35.  
  36. REM $INCLUDE: 'QBSCR.INC'
  37.  
  38. '┌────────────────────────────────────────────────────────────────────────┐
  39. '│  All other DECLARE statements.                                         │
  40. '└────────────────────────────────────────────────────────────────────────┘
  41.  
  42. DECLARE SUB BuildScreenModes ()
  43. DECLARE SUB ClrScrModes ()
  44. DECLARE SUB ExplodeTypes ()
  45. DECLARE SUB FrameTypes ()
  46. DECLARE SUB Main ()
  47. DECLARE SUB Quit ()
  48. DECLARE SUB WindowTypes ()
  49.  
  50. '┌────────────────────────────────────────────────────────────────────────┐
  51. '│  Declare global variables and constants.                               │
  52. '└────────────────────────────────────────────────────────────────────────┘
  53.  
  54. CONST FALSE = 0, TRUE = NOT FALSE
  55. COMMON SHARED marker$
  56. COMMON SHARED kolor
  57.  
  58. '┌────────────────────────────────────────────────────────────────────────┐
  59. '│  DIMension all necessary arrays.                                       │
  60. '└────────────────────────────────────────────────────────────────────────┘
  61.  
  62. DIM SHARED menuChoices$(6)
  63.  
  64. '┌────────────────────────────────────────────────────────────────────────┐
  65. '│  Determine whether or not the host machine has color capability.       │
  66. '│  This is accomplished via the QBSCR ColorChk function.  For more       │
  67. '│  detail, see the QBSCR documentation or the included SAMPLE program.   │
  68. '└────────────────────────────────────────────────────────────────────────┘
  69.  
  70. IF ColorChk THEN
  71.     kolor = TRUE
  72. ELSE
  73.     kolor = FALSE
  74. END IF
  75.  
  76. '┌────────────────────────────────────────────────────────────────────────┐
  77. '│  Call the function "Main."  This routine drives the entire program.    │
  78. '└────────────────────────────────────────────────────────────────────────┘
  79.  
  80. Main
  81.  
  82. '┌────────────────────────────────────────────────────────────────────────┐
  83. '│  Quit the REF program.                                                 │
  84. '└────────────────────────────────────────────────────────────────────────┘
  85.  
  86. Quit
  87. END
  88.  
  89. SUB BuildScreenModes
  90.  
  91. '┌────────────────────────────────────────────────────────────────────────┐
  92. '│  This sub-program runs through all the different modes that the        │
  93. '│  BuildScreen subroutine supports.  The user may press ESCape during    │
  94. '│  the pause to quit.                                                    │
  95. '└────────────────────────────────────────────────────────────────────────┘
  96.   
  97. '┌────────────────────────────────────────────────────────────────────────┐
  98. '│  Set colors to something with black background and clear the screen.   │
  99. '└────────────────────────────────────────────────────────────────────────┘
  100.  
  101. COLOR 7, 0
  102. CLS
  103.  
  104. '┌────────────────────────────────────────────────────────────────────────┐
  105. '│  Define the variable esc$ as the ASCII code for the ESCape character.  │
  106. '└────────────────────────────────────────────────────────────────────────┘
  107.   
  108. esc$ = CHR$(27)
  109.  
  110. '┌────────────────────────────────────────────────────────────────────────┐
  111. '│  Set the colors based on the value of the Kolor variable.  If Kolor is │
  112. '│  false, use monochrome colors.  If Kolor is true, use something more   │
  113. '│  interesting (in this case, Cyan on Black).  While we're here, we'll   │
  114. '│  also define the disk file containing the screen to display.           │
  115. '└────────────────────────────────────────────────────────────────────────┘
  116.   
  117. IF kolor THEN
  118.     windowForeColor% = 0     ' Black
  119.     windowBackColor% = 3     ' Cyan
  120.     inputForeColor% = 15     ' Bright White
  121.     inputBackColor% = 0      ' Black
  122.     screenFore% = 11         ' Bright Cyan
  123.     screenBack% = 0          ' Black
  124.     fillFore% = 9            ' Bright Blue
  125.     fillBack% = 0            ' Black
  126.     buildScreenFile$ = "TESTSCR.CLR"
  127. ELSE
  128.     windowForeColor% = 0     ' Black
  129.     windowBackColor% = 7     ' White
  130.     inputForeColor% = 15     ' Bright White
  131.     inputBackColor% = 0      ' Black
  132.     screenFore% = 15         ' Bright White
  133.     screenBack% = 0          ' Black
  134.     fillFore% = 7            ' White
  135.     fillBack% = 0            ' Black
  136.     buildScreenFile$ = "TESTSCR.MON"
  137. END IF
  138.  
  139. '┌────────────────────────────────────────────────────────────────────────┐
  140. '│  Let user input the mode they wish to see.  If ESC, then quit.         │
  141. '└────────────────────────────────────────────────────────────────────────┘
  142.  
  143. maxModes% = 15
  144. done% = FALSE
  145. DO
  146.  
  147.     '┌────────────────────────────────────────────────────────────────────┐
  148.     '│  Clear the screen.                                                 │
  149.     '└────────────────────────────────────────────────────────────────────┘
  150.  
  151.     COLOR 7, 0
  152.     CLS
  153.  
  154.     '┌────────────────────────────────────────────────────────────────────┐
  155.     '│  Make a window in the middle in which instructions will be placed. │
  156.     '└────────────────────────────────────────────────────────────────────┘
  157.  
  158.     MakeWindow 10, 30, 14, 50, windowForeColor%, windowBackColor%, 0, 0, -1, 0, ""
  159.   
  160.     '┌────────────────────────────────────────────────────────────────────┐
  161.     '│  Add some instructional text in the center window.                 │
  162.     '└────────────────────────────────────────────────────────────────────┘
  163.  
  164.     COLOR windowForeColor%, windowBackColor%
  165.     LOCATE 11, 32, 0: PRINT "Enter BuildScreen"
  166.     LOCATE 12, 33, 0: PRINT "Mode (0-"; LTRIM$(RTRIM$(STR$(maxModes%))); ")"
  167.     Center "<To QUIT hit ESC>", 13
  168.  
  169.     '┌────────────────────────────────────────────────────────────────────┐
  170.     '│  Get input from user via GetString function. Loop until valid.     │
  171.     '└────────────────────────────────────────────────────────────────────┘
  172.  
  173.     validNums$ = "0123456789" + CHR$(27)
  174.     DO
  175.         numOK% = TRUE
  176.         userChoice$ = ""
  177.         COLOR inputForeColor%, inputBackColor%
  178.         LOCATE 12, 46, 0: PRINT SPACE$(2)
  179.         LOCATE 12, 46, 1
  180.         userChoice$ = GetString$(46, 12, 2, inputForeColor%, inputBackColor%)
  181.         FOR i% = 1 TO LEN(userChoice$)
  182.             IF INSTR(validNums$, MID$(userChoice$, i%, 1)) = FALSE THEN
  183.                 numOK% = FALSE
  184.             END IF
  185.         NEXT i%
  186.         IF VAL(userChoice$) < 0 OR VAL(userChoice$) > maxModes% THEN
  187.             numOK% = FALSE
  188.         END IF
  189.     LOOP UNTIL numOK%
  190.   
  191.     '┌────────────────────────────────────────────────────────────────────┐
  192.     '│  If the user pressed ESCape, then exit the subroutine and return   │
  193.     '│  to the main menu.  Otherwise, clear the screen with the mode      │
  194.     '│  indicated by the user input number.                               │
  195.     '└────────────────────────────────────────────────────────────────────┘
  196.   
  197.     IF userChoice$ = esc$ THEN
  198.         EXIT SUB
  199.     ELSE
  200.         BuildScreen buildScreenFile$, VAL(userChoice$)
  201.     END IF
  202.  
  203.     '┌─────────────────────────────────────────────────────────────────────┐
  204.     '│  After the screen has cleared, tell user to hit a key and wait for  │
  205.     '│  them to hit one.                                                   │
  206.     '└─────────────────────────────────────────────────────────────────────┘
  207.   
  208.     pause$ = INPUT$(1)
  209.  
  210. LOOP UNTIL done%
  211.  
  212. END SUB
  213.  
  214. SUB ClrScrModes
  215.  
  216. '┌────────────────────────────────────────────────────────────────────────┐
  217. '│  This sub-program runs through all the different modes that the        │
  218. '│  ClrScr subroutine supports.  The user may press ESCape during pauses  │
  219. '│  to quit.                                                              │
  220. '└────────────────────────────────────────────────────────────────────────┘
  221.    
  222. '┌────────────────────────────────────────────────────────────────────────┐
  223. '│  Set colors to something with black background and clear the screen.   │
  224. '└────────────────────────────────────────────────────────────────────────┘
  225.  
  226. COLOR 7, 0
  227. CLS
  228.  
  229. '┌────────────────────────────────────────────────────────────────────────┐
  230. '│  Define the variable Esc$ as the ASCII code for the ESCape character.  │
  231. '└────────────────────────────────────────────────────────────────────────┘
  232.    
  233. esc$ = CHR$(27)
  234.  
  235. '┌────────────────────────────────────────────────────────────────────────┐
  236. '│  Set the colors based on the value of the Kolor variable.  If Kolor is │
  237. '│  false, use monochrome colors.  If Kolor is true, use something more   │
  238. '│  interesting (in this case, Cyan on Black).                            │
  239. '└────────────────────────────────────────────────────────────────────────┘
  240.    
  241. IF kolor THEN
  242.     fillForeColor% = 9       ' Bright Blue
  243.     fillBackColor% = 0       ' Black
  244.     windowForeColor% = 0     ' Black
  245.     windowBackColor% = 3     ' Cyan
  246.     inputForeColor% = 15     ' Bright White
  247.     inputBackColor% = 0      ' Black
  248. ELSE
  249.     fillForeColor% = 7       ' White
  250.     fillBackColor% = 0       ' Black
  251.     windowForeColor% = 0     ' Black
  252.     windowBackColor% = 7     ' White
  253.     inputForeColor% = 15     ' Bright White
  254.     inputBackColor% = 0      ' Black
  255. END IF
  256.  
  257. '┌────────────────────────────────────────────────────────────────────────┐
  258. '│  Use a FOR...NEXT loop and iterate ten times (from 0 to 9).  This way  │
  259. '│  we can use the loop control variable as the Mode passed to ClrScr.    │
  260. '│  Fill the screen with characters and then clear it ten ways.           │
  261. '└────────────────────────────────────────────────────────────────────────┘
  262.  
  263. maxModes% = 15
  264. done% = FALSE
  265. DO
  266.  
  267.     '┌────────────────────────────────────────────────────────────────────┐
  268.     '│  Fill the screen with the '░' (ASCII 176) character.               │
  269.     '└────────────────────────────────────────────────────────────────────┘
  270.    
  271.     COLOR fillForeColor%, fillBackColor%
  272.     FOR y% = 1 TO 25
  273.         LOCATE y%, 1, 0
  274.         PRINT STRING$(80, 176);
  275.     NEXT y%
  276.  
  277.     '┌────────────────────────────────────────────────────────────────────┐
  278.     '│  Make a window in the middle in which instructions will be placed. │
  279.     '└────────────────────────────────────────────────────────────────────┘
  280.  
  281.     MakeWindow 10, 30, 14, 50, windowForeColor%, windowBackColor%, 0, 0, 0, 0, ""
  282.    
  283.     '┌────────────────────────────────────────────────────────────────────┐
  284.     '│  Add some instructional text in the center window.                 │
  285.     '└────────────────────────────────────────────────────────────────────┘
  286.   
  287.     COLOR windowForeColor%, windowBackColor%
  288.     LOCATE 11, 34, 0: PRINT "Enter ClrScr"
  289.     LOCATE 12, 33, 0: PRINT "Mode (0-"; LTRIM$(RTRIM$(STR$(maxModes%))); ")"
  290.     Center "<To QUIT hit ESC>", 13
  291.  
  292.     '┌────────────────────────────────────────────────────────────────────┐
  293.     '│  Get input from user via GetString function. Loop until valid.     │
  294.     '└────────────────────────────────────────────────────────────────────┘
  295.  
  296.     validNums$ = "0123456789" + CHR$(27)
  297.     DO
  298.         numOK% = TRUE
  299.         userChoice$ = ""
  300.         COLOR inputForeColor%, inputBackColor%
  301.         LOCATE 12, 46, 0: PRINT SPACE$(2)
  302.         LOCATE 12, 46, 1
  303.         userChoice$ = GetString$(46, 12, 2, inputForeColor%, inputBackColor%)
  304.         FOR i% = 1 TO LEN(userChoice$)
  305.             IF INSTR(validNums$, MID$(userChoice$, i%, 1)) = FALSE THEN
  306.                 numOK% = FALSE
  307.             END IF
  308.         NEXT i%
  309.         IF VAL(userChoice$) < 0 OR VAL(userChoice$) > maxModes% THEN
  310.             numOK% = FALSE
  311.         END IF
  312.     LOOP UNTIL numOK%
  313.    
  314.     '┌────────────────────────────────────────────────────────────────────┐
  315.     '│  If the user pressed ESCape, then exit the subroutine and return   │
  316.     '│  to the main menu.  Otherwise, clear the screen with the mode      │
  317.     '│  indicated by the user input number.                               │
  318.     '└────────────────────────────────────────────────────────────────────┘
  319.    
  320.     IF userChoice$ = esc$ THEN
  321.         EXIT SUB
  322.     ELSE
  323.         ClrScr VAL(userChoice$), " "
  324.     END IF
  325.  
  326.     '┌─────────────────────────────────────────────────────────────────────┐
  327.     '│  After the screen has cleared, tell user to hit a key and wait for  │
  328.     '│  them to hit one.                                                   │
  329.     '└─────────────────────────────────────────────────────────────────────┘
  330.    
  331.     LOCATE 25, 1, 0
  332.     PRINT "Hit any key to continue...";
  333.     pause$ = INPUT$(1)
  334.  
  335. LOOP UNTIL done%
  336.  
  337. END SUB
  338.  
  339. SUB ExplodeTypes
  340.  
  341. '┌────────────────────────────────────────────────────────────────────────┐
  342. '│  This routine shows demonstrates the three possible explode types      │
  343. '│  available in the MakeWindow subroutine.  For more information, see    │
  344. '│  the SAMPLE program or the QBSCR documentation.                        │
  345. '└────────────────────────────────────────────────────────────────────────┘
  346.  
  347. '┌────────────────────────────────────────────────────────────────────────┐
  348. '│  Set the screen colors s they have a black background and then clear   │
  349. '│  the screen.                                                           │
  350. '└────────────────────────────────────────────────────────────────────────┘
  351.  
  352. COLOR 15, 0
  353. CLS
  354.  
  355. '┌────────────────────────────────────────────────────────────────────────┐
  356. '│  Set the colors based on the value of the Kolor variable.  If Kolor is │
  357. '│  false, use monochrome colors.  If Kolor is true, use something more   │
  358. '│  interesting (in this case, bright White on Green).                    │
  359. '└────────────────────────────────────────────────────────────────────────┘
  360.  
  361. IF kolor THEN
  362.     foreColor% = 15   '== Bright white
  363.     backColor% = 2    '== Green
  364. ELSE
  365.     foreColor% = 0    '== Black
  366.     backColor% = 7    '== White
  367. END IF
  368.  
  369. '┌────────────────────────────────────────────────────────────────────────┐
  370. '│  Display an informational header at the top of the screen.             │
  371. '└────────────────────────────────────────────────────────────────────────┘
  372.  
  373. Center "Demonstrating the QBSCR MakeWindow", 1
  374. Center "E X P L O D E   T Y P E S", 3
  375.  
  376. '┌────────────────────────────────────────────────────────────────────────┐
  377. '│  Run the demo for Mode 1 - Automatic adjust mode.                      │
  378. '└────────────────────────────────────────────────────────────────────────┘
  379.  
  380. '┌────────────────────────────────────────────────────────────────────────┐
  381. '│  Place a pause message at the bottom of the screen and wait for the    │
  382. '│  user to hit a key before demonstrating explode type 1.                │
  383. '└────────────────────────────────────────────────────────────────────────┘
  384.  
  385. Center "Hit any key for Explode Type 1", 23
  386. pause$ = INPUT$(1)
  387.  
  388. '┌────────────────────────────────────────────────────────────────────────┐
  389. '│  Blank out the pause message at the bottom of the screen.              │
  390. '└────────────────────────────────────────────────────────────────────────┘
  391.  
  392. Center SPACE$(60), 23
  393.  
  394. '┌────────────────────────────────────────────────────────────────────────┐
  395. '│  Make a window using explode type 1.                                   │
  396. '└────────────────────────────────────────────────────────────────────────┘
  397.  
  398. MakeWindow 7, 16, 17, 65, foreColor%, backColor%, 1, 4, -1, 1, ""
  399.  
  400. '┌────────────────────────────────────────────────────────────────────────┐
  401. '│  Add a bit of explanatory text + pause message to window.              │
  402. '└────────────────────────────────────────────────────────────────────────┘
  403.  
  404. Center "Explode Type was 1", 8
  405. Center "This explode type provides a smooth window", 11
  406. Center "expansion so all corners are reached", 12
  407. Center "at the same time", 13
  408. Center "Hit any key to continue", 16
  409.  
  410. '┌────────────────────────────────────────────────────────────────────────┐
  411. '│  Wait for user to hit a key before proceeding.                         │
  412. '└────────────────────────────────────────────────────────────────────────┘
  413.  
  414. pause$ = INPUT$(1)
  415.  
  416. '┌────────────────────────────────────────────────────────────────────────┐
  417. '│  Run the demo for Mode 2 - Horizontal Bias Mode.                       │
  418. '└────────────────────────────────────────────────────────────────────────┘
  419.  
  420. '┌────────────────────────────────────────────────────────────────────────┐
  421. '│  Change colors to black background.                                    │
  422. '└────────────────────────────────────────────────────────────────────────┘
  423.  
  424. COLOR 15, 0
  425.  
  426. '┌────────────────────────────────────────────────────────────────────────┐
  427. '│  Use the Wipe subroutine to clear a selected part of the screen, in    │
  428. '│  this case to erase the first window.  For more information on Wipe    │
  429. '│  see the SAMPLE program or the QBSCR documentation.                    │
  430. '└────────────────────────────────────────────────────────────────────────┘
  431.  
  432. Wipe 6, 18, 1, 80, 0
  433.  
  434. '┌────────────────────────────────────────────────────────────────────────┐
  435. '│  Place a pause message at the bottom of the screen and wait for the    │
  436. '│  user to hit a key before demonstrating explode type 2.                │
  437. '└────────────────────────────────────────────────────────────────────────┘
  438.  
  439. Center "Hit any key for Explode Type 2", 23
  440. pause$ = INPUT$(1)
  441.  
  442. '┌────────────────────────────────────────────────────────────────────────┐
  443. '│  Blank out the pause message at the bottom of the screen.              │
  444. '└────────────────────────────────────────────────────────────────────────┘
  445.  
  446. Center SPACE$(60), 23
  447.  
  448. '┌────────────────────────────────────────────────────────────────────────┐
  449. '│  Make a window using explode type 2.                                   │
  450. '└────────────────────────────────────────────────────────────────────────┘
  451.  
  452. MakeWindow 8, 11, 15, 70, foreColor%, backColor%, 1, 4, -1, 2, ""
  453.  
  454. '┌────────────────────────────────────────────────────────────────────────┐
  455. '│  Add a bit of explanatory text + pause message to window.              │
  456. '└────────────────────────────────────────────────────────────────────────┘
  457.  
  458. Center "Explode Type was 2", 9
  459. Center "This mode provides almost a completely horizontal", 11
  460. Center "expansion.  Use for wide, short windows.", 12
  461. Center "Hit any key to continue", 14
  462.  
  463. '┌────────────────────────────────────────────────────────────────────────┐
  464. '│  Wait for user to hit a key before proceeding.                         │
  465. '└────────────────────────────────────────────────────────────────────────┘
  466.  
  467. pause$ = INPUT$(1)
  468.  
  469. '┌────────────────────────────────────────────────────────────────────────┐
  470. '│  Run the demo for Mode 2 - Horizontal Bias Mode.                       │
  471. '└────────────────────────────────────────────────────────────────────────┘
  472.  
  473. '┌────────────────────────────────────────────────────────────────────────┐
  474. '│  Change colors to black background.                                    │
  475. '└────────────────────────────────────────────────────────────────────────┘
  476.  
  477. COLOR 15, 0
  478.  
  479. '┌────────────────────────────────────────────────────────────────────────┐
  480. '│  Use the Wipe subroutine to clear a selected part of the screen, in    │
  481. '│  this case to erase the second window.  For more information on Wipe   │
  482. '│  see the SAMPLE program or the QBSCR documentation.                    │
  483. '└────────────────────────────────────────────────────────────────────────┘
  484.  
  485. Wipe 7, 16, 1, 80, 0
  486.  
  487. '┌────────────────────────────────────────────────────────────────────────┐
  488. '│  Place a pause message at the bottom of the screen and wait for the    │
  489. '│  user to hit a key before demonstrating explode type 3.                │
  490. '└────────────────────────────────────────────────────────────────────────┘
  491.  
  492. Center "Hit any key for Explode Type 3", 23
  493. pause$ = INPUT$(1)
  494.  
  495. '┌────────────────────────────────────────────────────────────────────────┐
  496. '│  Blank out the pause message at the bottom of the screen.              │
  497. '└────────────────────────────────────────────────────────────────────────┘
  498.  
  499. Center SPACE$(60), 23
  500.  
  501. '┌────────────────────────────────────────────────────────────────────────┐
  502. '│  Make a window using explode type 3.                                   │
  503. '└────────────────────────────────────────────────────────────────────────┘
  504.  
  505. MakeWindow 5, 31, 21, 50, foreColor%, backColor%, 1, 4, -1, 3, ""
  506.  
  507. '┌────────────────────────────────────────────────────────────────────────┐
  508. '│  Add a bit of explanatory text + pause message to window.              │
  509. '└────────────────────────────────────────────────────────────────────────┘
  510.  
  511. Center "Type was 3", 6
  512. Center "This type of", 9
  513. Center "expansion is", 10
  514. Center "biased in the", 11
  515. Center "vertical", 12
  516. Center "direction.", 13
  517. Center "Use for tall", 15
  518. Center "thin windows", 16
  519. Center "like this one.", 17
  520. Center "Easy, no?", 20
  521.  
  522. '┌────────────────────────────────────────────────────────────────────────┐
  523. '│  Set colors to Bright White on Black for pause message.                │
  524. '└────────────────────────────────────────────────────────────────────────┘
  525.  
  526. COLOR 15, 0
  527.  
  528. '┌────────────────────────────────────────────────────────────────────────┐
  529. '│  Wait for user to hit a key before proceeding.                         │
  530. '└────────────────────────────────────────────────────────────────────────┘
  531.  
  532. Center "  Hit any key for the main menu  ", 23
  533. pause$ = INPUT$(1)
  534.  
  535. END SUB
  536.  
  537. SUB FrameTypes
  538.  
  539. '┌────────────────────────────────────────────────────────────────────────┐
  540. '│  The FrameTypes subroutine displays a reference screen depicting all   │
  541. '│  6 possible freame types in the MakeWindow subroutine.                 │
  542. '└────────────────────────────────────────────────────────────────────────┘
  543.  
  544. '┌────────────────────────────────────────────────────────────────────────┐
  545. '│  Change colors to something with a black background.                   │
  546. '└────────────────────────────────────────────────────────────────────────┘
  547.  
  548. COLOR 7, 0
  549. CLS
  550.  
  551. '┌────────────────────────────────────────────────────────────────────────┐
  552. '│  Set the colors based on the value of the Kolor variable.  If Kolor is │
  553. '│  false, use monochrome colors.  If Kolor is true, use something more   │
  554. '│  interesting (in this case, bright White on Magenta).                  │
  555. '└────────────────────────────────────────────────────────────────────────┘
  556.  
  557. IF kolor THEN
  558.     foreColor% = 15   '== Bright white
  559.     backColor% = 5    '== Magenta
  560. ELSE
  561.     foreColor% = 0    '== Black
  562.     backColor% = 7    '== White
  563. END IF
  564.  
  565. '┌────────────────────────────────────────────────────────────────────────┐
  566. '│  Make six windows, one at a time.  After each window, fill inside it   │
  567. '│  text that tells the user what frame type it is.                       │
  568. '└────────────────────────────────────────────────────────────────────────┘
  569.  
  570. '== First row of 3
  571.  
  572. MakeWindow 1, 5, 7, 25, foreColor%, backColor%, 1, 0, -1, 0, ""
  573. OffCenter "Type = 0", 4, 5, 25
  574. MakeWindow 1, 30, 7, 50, foreColor%, backColor%, 1, 1, -1, 0, ""
  575. OffCenter "Type = 1", 4, 30, 50
  576. MakeWindow 1, 55, 7, 75, foreColor%, backColor%, 1, 2, -1, 0, ""
  577. OffCenter "Type = 2", 4, 55, 75
  578.  
  579. '== Second row of 3
  580.  
  581. MakeWindow 9, 5, 15, 25, foreColor%, backColor%, 1, 3, -1, 0, ""
  582. OffCenter "Type = 3", 12, 5, 25
  583. MakeWindow 9, 30, 15, 50, foreColor%, backColor%, 1, 4, -1, 0, ""
  584. OffCenter "Type = 4", 12, 30, 50
  585. MakeWindow 9, 55, 15, 75, foreColor%, backColor%, 1, 5, -1, 0, ""
  586. OffCenter "Type = 5", 12, 55, 75
  587.  
  588. '┌────────────────────────────────────────────────────────────────────────┐
  589. '│  Change the colors so our text won't have a magenta background.        │
  590. '└────────────────────────────────────────────────────────────────────────┘
  591.  
  592. COLOR 15, 0
  593.  
  594. '┌────────────────────────────────────────────────────────────────────────┐
  595. '│  Add some explanatory and instructional text underneath the windows.   │
  596. '└────────────────────────────────────────────────────────────────────────┘
  597.  
  598. Center "F R A M E    T Y P E S", 17
  599. Center "Hit any key to return to the main menu", 19
  600. Center "Note that if your printer supports extended characters, you can use", 22
  601. Center "Shift+PrtSc to get a hard copy of this reference screen", 23
  602.  
  603. '┌────────────────────────────────────────────────────────────────────────┐
  604. '│  Pause until the user hits a key.  We will then return to Main.        │
  605. '└────────────────────────────────────────────────────────────────────────┘
  606.  
  607. pause$ = INPUT$(1)
  608.  
  609. END SUB
  610.  
  611. SUB Main
  612.  
  613. '┌────────────────────────────────────────────────────────────────────────┐
  614. '│  This routine drives the functional part of the program.  It first     │
  615. '│  sets up the display and creates a menu (using the QBSCR "MakeMenu"    │
  616. '│  function) and allows the user to select which item to reference.      │
  617. '│  It then executes the appropriate subroutine based on the user's       │
  618. '│  selection.  Selecting "Quit" returns control to the main module.      │
  619. '└────────────────────────────────────────────────────────────────────────┘
  620.  
  621. '┌────────────────────────────────────────────────────────────────────────┐
  622. '│  First define a few variables, specifically the array that will hold   │
  623. '│  the menu choices.  Throw in a few others for spice.                   │
  624. '└────────────────────────────────────────────────────────────────────────┘
  625.  
  626. menuChoices$(1) = "^Window Types"
  627. menuChoices$(2) = "^Frame Types"
  628. menuChoices$(3) = "^Explode Types"
  629. menuChoices$(4) = "^ClrScr Modes"
  630. menuChoices$(5) = "^BuildScreen Modes"
  631. menuChoices$(6) = "^Quit"
  632. numberOfChoices% = 6
  633. justification$ = "L"
  634. marker$ = "^"
  635.  
  636. windowTop = 9         '   ─┐  We'll use these variables as our screen
  637. windowBottom = 16     '    │  coordinates.  This way, if we need to change
  638. windowLeft = 29       '    │  them, we only have to change them right here
  639. windowRight = 52      '   ─┘  and not throughout the whole module.
  640.  
  641. '┌────────────────────────────────────────────────────────────────────────┐
  642. '│  Sit in a WHILE loop.  If we get menu entry 5 (Quit) then set          │
  643. '│  the variable "Done" to True, and exit.                                │
  644. '└────────────────────────────────────────────────────────────────────────┘
  645.  
  646. done = FALSE
  647. WHILE NOT done
  648.  
  649.     '┌────────────────────────────────────────────────────────────────────────┐
  650.     '│  Set the colors of the menu based on the boolean value of the Kolor    │
  651.     '│  variable.  If Kolor is False, we use monochrome colors.  If Kolor is  │
  652.     '│  True, we'll use grey on blue.                                         │
  653.     '└────────────────────────────────────────────────────────────────────────┘
  654.  
  655.     IF kolor THEN
  656.         foreColor% = 7    ' Grey (pale white)
  657.         backColor% = 1    ' Blue
  658.         qfg% = 15         ' Bright white
  659.         qbg% = 1          ' Blue
  660.     ELSE
  661.         foreColor% = 0    ' Black
  662.         backColor% = 7    ' White
  663.         qfg% = 15         ' Bright White
  664.         qbg% = 0          ' Black
  665.     END IF
  666.  
  667.     '┌────────────────────────────────────────────────────────────────────────┐
  668.     '│  Clear the screen.  But first set the colors to something with a black │
  669.     '│  background.  This way, when the screen is cleared, it will be black   │
  670.     '│  and not some other stray color.                                       │
  671.     '└────────────────────────────────────────────────────────────────────────┘
  672.  
  673.     COLOR 7, 0   ' White on a black background
  674.     CLS
  675.  
  676.     '┌────────────────────────────────────────────────────────────────────────┐
  677.     '│  Add a pleasing background of '░' (ASCII 176) to display our menu on.  │
  678.     '└────────────────────────────────────────────────────────────────────────┘
  679.  
  680.     FOR x% = 1 TO 25
  681.         LOCATE x%, 1, 0
  682.         PRINT STRING$(80, 176);
  683.     NEXT x%
  684.  
  685.     '┌────────────────────────────────────────────────────────────────────────┐
  686.     '│  Let's add the screen header and footer now.  The header consists of   │
  687.     '│  a title and copyright notice (you're not allowed to remove this -     │
  688.     '│  legal penalties and all that), and the footer contains instructions   │
  689.     '│  for the user on how to use the menu.                                  │
  690.     '└────────────────────────────────────────────────────────────────────────┘
  691.  
  692.     COLOR foreColor%, backColor%  'Change to our selected colors
  693.  
  694.     LOCATE 1, 1, 0                ' These 3 lines are the header...
  695.     PRINT SPACE$(80);
  696.     Center "REF ■ A companion to the QBSCR screen routines ■ (C) 1989 by Tony Martin", 1
  697.  
  698.     LOCATE 25, 1, 0               ' ...and these 3 are the footer.
  699.     PRINT SPACE$(80);
  700.     Center "Use the  and  or PgUp and PgDn keys to move ■ ENTER to select", 25
  701.  
  702.     '┌────────────────────────────────────────────────────────────────────────┐
  703.     '│  Make the window in which we will place our menu.  We are using the    │
  704.     '│  QBSCR "MakeWindow" function to do this.  Note that we are going to    │
  705.     '│  use literal values for a few of the parameters.  See the QBSCR        │
  706.     '│  documentation or the SAMPLE program for more information.             │
  707.     '└────────────────────────────────────────────────────────────────────────┘
  708.  
  709.     MakeWindow windowTop, windowLeft, windowBottom, windowRight, foreColor%, backColor%, 0, 1, 0, -1, ""
  710.  
  711.     '┌────────────────────────────────────────────────────────────────────────┐
  712.     '│  Now we add a decorative line to the frame.                            │
  713.     '└────────────────────────────────────────────────────────────────────────┘
  714.  
  715.     FOR x = windowTop + 1 TO windowBottom - 1
  716.         LOCATE x, windowLeft + 2, 0
  717.         PRINT "│"
  718.     NEXT x
  719.  
  720.     '┌────────────────────────────────────────────────────────────────────┐
  721.     '│  Make the menu and place user's response in Response%.             │
  722.     '└────────────────────────────────────────────────────────────────────┘
  723.    
  724.     response% = MakeMenu%(menuChoices$(), numberOfChoices%, justification$, windowLeft + 4, windowRight - 1, windowTop + 1, marker$, foreColor%, backColor%, 15, 0, qfg%, qbg%)
  725.  
  726.     '┌────────────────────────────────────────────────────────────────────┐
  727.     '│  Decide what to do based on the user's input.                      │
  728.     '└────────────────────────────────────────────────────────────────────┘
  729.  
  730.     SELECT CASE response%
  731.  
  732.         CASE 1        ' User chose WINDOW TYPES
  733.             WindowTypes
  734.         CASE 2        ' User chose FRAME TYPES
  735.             FrameTypes
  736.         CASE 3        ' User chose EXPLODE TYPES
  737.             ExplodeTypes
  738.         CASE 4        ' User chose CLRSCR MODES
  739.             ClrScrModes
  740.         CASE 5        ' User chose BUILDSCREEN MODES
  741.             BuildScreenModes
  742.         CASE 6        ' User chose QUIT
  743.             done = TRUE
  744.         CASE ELSE     ' User hit something else, like ESCape
  745.  
  746.     END SELECT
  747.  
  748. WEND
  749.  
  750. END SUB
  751.  
  752. SUB Quit
  753.  
  754. '┌────────────────────────────────────────────────────────────────────────┐
  755. '│  This routine simply resets colors to mono and clears the screen.      │
  756. '└────────────────────────────────────────────────────────────────────────┘
  757.  
  758. COLOR 7, 0
  759. ClrScr 14, " "
  760. LOCATE 1, 1, 1
  761.  
  762. END SUB
  763.  
  764. SUB WindowTypes
  765.  
  766. '┌────────────────────────────────────────────────────────────────────────┐
  767. '│  The WindowTypes subroutine displays a the reference screen depicting  │
  768. '│  all ten possible window types in the MakeWindow subroutine.           │
  769. '└────────────────────────────────────────────────────────────────────────┘
  770.  
  771. '┌────────────────────────────────────────────────────────────────────────┐
  772. '│  Set colors to neutral and clear the display.                          │
  773. '└────────────────────────────────────────────────────────────────────────┘
  774.  
  775. COLOR 7, 0
  776. CLS
  777.  
  778. '┌────────────────────────────────────────────────────────────────────────┐
  779. '│  Set new colors for the window reference screen.  If the variable      │
  780. '│  Kolor is True, then use the colors bright white on red.  If Kolor is  │
  781. '│  false, then use mono colors (white on black).                         │
  782. '└────────────────────────────────────────────────────────────────────────┘
  783.  
  784. IF kolor THEN
  785.     foreColor% = 15   '== Bright white
  786.     backColor% = 4    '== Red
  787. ELSE
  788.     foreColor% = 0    '== Black
  789.     backColor% = 7    '== White
  790. END IF
  791.  
  792. '┌────────────────────────────────────────────────────────────────────────┐
  793. '│  Make ten windows, one at a time.  After each window, fill inside it   │
  794. '│  text that tells the user what window type it is.                      │
  795. '└────────────────────────────────────────────────────────────────────────┘
  796.  
  797. '== First row of 5 windows
  798.  
  799. MakeWindow 1, 1, 7, 15, foreColor%, backColor%, 0, 0, -1, 0, ""
  800. OffCenter "Type = 0", 4, 1, 15
  801. MakeWindow 1, 17, 7, 31, foreColor%, backColor%, 1, 0, -1, 0, ""
  802. OffCenter "Type = 1", 4, 17, 31
  803. MakeWindow 1, 33, 7, 47, foreColor%, backColor%, 2, 0, -1, 0, ""
  804. OffCenter "Type = 2", 4, 33, 47
  805. MakeWindow 1, 49, 7, 63, foreColor%, backColor%, 3, 0, -1, 0, ""
  806. OffCenter "Type = 3", 4, 49, 63
  807. MakeWindow 1, 65, 7, 79, foreColor%, backColor%, 4, 0, -1, 0, ""
  808. OffCenter "Type = 4", 4, 65, 79
  809.  
  810. '== Second row of 5 windows
  811.  
  812. MakeWindow 9, 1, 15, 15, foreColor%, backColor%, 5, 0, -1, 0, ""
  813. OffCenter "Type = 5", 11, 1, 15
  814. MakeWindow 9, 17, 15, 31, foreColor%, backColor%, 6, 0, -1, 0, ""
  815. OffCenter "Type = 6", 11, 17, 31
  816. MakeWindow 9, 33, 15, 47, foreColor%, backColor%, 7, 0, -1, 0, ""
  817. OffCenter "Type = 7", 10, 33, 47
  818. MakeWindow 9, 49, 15, 63, foreColor%, backColor%, 8, 0, -1, 0, ""
  819. OffCenter "Type = 8", 14, 49, 63
  820. MakeWindow 9, 65, 15, 79, foreColor%, backColor%, 9, 0, -1, 0, ""
  821. OffCenter "Type = 9", 14, 65, 79
  822.  
  823. '┌────────────────────────────────────────────────────────────────────────┐
  824. '│  Change the colors so our text won't have a red background.            │
  825. '└────────────────────────────────────────────────────────────────────────┘
  826.  
  827. IF kolor THEN
  828.     COLOR 15, 0
  829. ELSE
  830.     COLOR 7, 0
  831. END IF
  832.  
  833. '┌────────────────────────────────────────────────────────────────────────┐
  834. '│  Add some explanatory and instructional text underneath the windows.   │
  835. '└────────────────────────────────────────────────────────────────────────┘
  836.  
  837. Center "W I N D O W    T Y P E S", 17
  838. Center "Hit any key to return to the main menu", 19
  839. Center "Note that if your printer supports extended characters, you can use", 22
  840. Center "Shift+PrtSc to get a hard copy of this reference screen", 23
  841.  
  842. '┌────────────────────────────────────────────────────────────────────────┐
  843. '│  Pause until the user hits a key.  We will then return to Main.        │
  844. '└────────────────────────────────────────────────────────────────────────┘
  845.  
  846. pause$ = INPUT$(1)
  847.  
  848. END SUB
  849.  
  850.