home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / s / shlp106.zip / SHLP1.EXE / DEMOSLIB.BAS next >
BASIC Source File  |  1991-12-30  |  5KB  |  170 lines

  1. '***************************************************************************
  2. '*         DEMOSHLB.BAS Copyright 1991 by Robert Pitcher - SimpleWare      *
  3. '*                                                                         *
  4. '*                 Be sure to start QuickBASIC as follows                  *
  5. '*                                                                         *
  6. '*                             QB /L SHELP                                 *
  7. '*                                                                         *
  8. '*          A demo to show the use of the routines contained in the        *
  9. '*                  Simply Help! library for QuickBASIC                    *
  10. '***************************************************************************
  11.  
  12. DEFINT A-Z
  13.  
  14.  
  15.  
  16. 'Declare Simply Help! Library routines
  17. DECLARE SUB SHelp (FilNam$, Scrn%, ErFlag%)
  18. DECLARE SUB SHelpM (FilNam$, Scrn%, ErFlag%)
  19.  
  20. DECLARE SUB SHelpOvr (FilNam$, Scrn%, ErFlag%, OvrPos%, Wcx%, Tcx%, Lcx%, Hcx%)
  21. DECLARE SUB SHelpOvrM (FilNam$, Scrn%, ErFlag%, OvrPos%, Wcx%, Tcx%, Lcx%, Hcx%)
  22.  
  23. DECLARE SUB SHelpGI (FilNam$, Scrn%, Array%())
  24. DECLARE SUB SHelpGT (FilNam$, Scrn%, ErFlag%, Lins%, T$())
  25.  
  26. COLOR 7, 0
  27.  
  28. Nam$ = "SHELP.EXE"                     'File to display
  29. VIEW PRINT
  30.  
  31. GOSUB BackScrn                         'Draw a background
  32.  
  33.  
  34. '----- Show the routine SHelp
  35. PRINT "Press any key to call the routine - Shelp ";
  36. GOSUB GetCh                            'Press a key
  37. Scrn = 1                               'Number of screen to display.
  38. CALL SHelp(Nam$, Scrn, Er)             'Display the screen
  39. IF Er GOTO ShError
  40.  
  41.  
  42. '----- Show the over ride routine
  43. GOSUB ClearMiddle
  44. PRINT "Press any key to call the routine - ShelpOvr ";
  45. GOSUB GetCh
  46.  
  47. Scrn = 5                   'Display screen 5
  48. PosFlag = -1               'Set to 0 to use default positions in file
  49. BoxColor = 7               'Set colors for mono screen
  50. TextColor = 7              'To use defaults set Colors to -1
  51. LinkColor = 15
  52. HiColor = 15
  53.  
  54. LOCATE 2, 2                'Display all screens in upper left corner
  55. CALL SHelpOvr(Nam$, Scrn, Er, PosFlag, BoxColor, TextColor, LinkColor, HiColor)
  56. IF Er GOTO ShError
  57.  
  58.  
  59.  
  60. '----- Try the Get Text routine
  61. GOSUB ClearMiddle
  62. PRINT "Press any key to call the routine - ShelpGT  ";
  63. GOSUB GetCh
  64.  
  65. DIM Txt$(25)                                    'String array to hold text
  66. Scrn = 7                                        'Number of screen
  67. CALL SHelpGT(Nam$, Scrn, Er, Lins, Txt$())      'Get the text
  68. IF Er GOTO ShError
  69.  
  70. COLOR 7, 0
  71. CLS                                             'Display the text returned
  72. PRINT " TEXT FROM SCREEN # 7:"
  73. PRINT STRING$(79, "-")
  74. FOR i = 1 TO Lins
  75.    PRINT Txt$(i)
  76. NEXT
  77. PRINT STRING$(79, "-")
  78.  
  79.  
  80.  
  81. '----- Show the Get Info routine
  82. LOCATE 25, 1, 1
  83. PRINT "       Press any key to call the routine - ShelpGI  ";
  84. GOSUB GetCh
  85.  
  86. DIM Info%(15)                             'Array to hold information
  87.                                           'Try less than 15
  88. Info(0) = 2                               'Set element 0 to number of screen
  89. CALL SHelpGI(Nam$, Er, Info())            'Get the info
  90. IF Er GOTO ShError
  91.  
  92. CLS
  93. '----- Display the information returned
  94. PRINT
  95. PRINT " Compiler Version: "; Info(1) / 100
  96. PRINT "        File Type: ";
  97. IF Info(2) = 0 THEN PRINT "Standard Help" ELSE PRINT "EXE File"
  98.  
  99. PRINT
  100. PRINT "  Number of screens: "; Info(3)
  101. PRINT "    Number of links: "; Info(4)
  102. PRINT
  103.  
  104. IF Info(0) THEN
  105.    PRINT
  106.    PRINT "  Information on Screen number: "; Info(0)
  107.    PRINT
  108.    PRINT "     Top line of window: "; Info(5)
  109.    PRINT "  Left column of window: "; Info(6)
  110.    PRINT "        Lines in window: "; Info(7)
  111.    PRINT "        Width of window: "; Info(8)
  112.    PRINT "               Box type: "; Info(9)
  113.    PRINT "                 Shadow: "; Info(10)
  114.    PRINT "        Number of links: "; Info(11)
  115.    PRINT "           Auto linking: "; Info(12)
  116.    PRINT "              Box color: "; Info(13)
  117.    PRINT "             Text color: "; Info(14)
  118.    PRINT "             Link color: "; Info(15)
  119. END IF
  120.  
  121. LOCATE 25, 4
  122. PRINT "Press any key to exit. ";
  123. GOSUB GetCh
  124. COLOR 7, 0
  125. CLS
  126. END
  127.  
  128.  
  129. GetCh:
  130.    a$ = INPUT$(1)
  131.    IF a$ = CHR$(27) THEN
  132.       COLOR 7, 0
  133.       CLS
  134.       END
  135.    END IF
  136. RETURN
  137.  
  138.  
  139. BackScrn:
  140.    CLS
  141.    COLOR 1, 7
  142.    PRINT STRING$(1999, 177);
  143.  
  144. ClearMiddle:
  145.    FOR i = 1 TO 5
  146.       LOCATE 10 + i, 15
  147.       PRINT SPACE$(50);
  148.    NEXT
  149.    LOCATE 13, 17, 1
  150. RETURN
  151.  
  152.  
  153. ShError:
  154.    COLOR 7, 0
  155.    CLS
  156.    PRINT "An error has occured within a Simply Help! routine. "
  157.    PRINT
  158.    SELECT CASE Er
  159.       CASE -1
  160.          PRINT "Invalid help file"
  161.       CASE -2
  162.          PRINT "Invalid screen number"
  163.       CASE -3
  164.          PRINT "Not enough elements"
  165.       CASE ELSE
  166.          PRINT "BASIC error code:"; Er
  167.    END SELECT
  168. END
  169.  
  170.