home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / tools / help / shed / demoslib.bas next >
Encoding:
BASIC Source File  |  1991-05-06  |  4.6 KB  |  160 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%)
  21. DECLARE SUB SHelpOvrM (FilNam$, Scrn%, ErFlag%, OvrPos%, Wcx%, Tcx%, Lcx%)
  22.  
  23. DECLARE SUB SHelpGI (FilNam$, Scrn%, Array%())
  24. DECLARE SUB SHelpGT (FilNam$, Scrn%, ErFlag%, Lins%, T$())
  25.  
  26.  
  27.  
  28. Nam$ = "SHLIB.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 = 3                               '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.  
  53. LOCATE 2, 2                'Display all screens in upper left corner
  54. CALL SHelpOvr(Nam$, Scrn, Er, PosFlag, BoxColor, TextColor, LinkColor)
  55. IF Er GOTO ShError
  56.  
  57.  
  58.  
  59. '----- Try the Get Text routine
  60. GOSUB ClearMiddle
  61. PRINT "Press any key to call the routine - ShelpGT  ";
  62. GOSUB GetCh
  63.  
  64. DIM Txt$(25)                                    'String array to hold text
  65. Scrn = 7                                        'Number of screen
  66. CALL SHelpGT(Nam$, Scrn, Er, Lins, Txt$())      'Get the text
  67. IF Er GOTO ShError
  68.  
  69. CLS                                             'Display the text returned
  70. PRINT " TEXT FROM SCREEN # 7:"
  71. PRINT STRING$(79, "-")
  72. FOR i = 1 TO Lins
  73.    PRINT Txt$(i)
  74. NEXT
  75. PRINT STRING$(79, "-")
  76.  
  77.  
  78.  
  79. '----- Show the Get Info routine
  80. LOCATE 24, 1, 1
  81. PRINT "       Press any key to call the routine - ShelpGI  ";
  82. GOSUB GetCh
  83.  
  84. DIM Info%(15)                             'Array to hold information
  85.                                           'Try less than 15
  86. Info(0) = 2                               'Set element 0 to number of screen
  87. CALL SHelpGI(Nam$, Er, Info())            'Get the info
  88. IF Er GOTO ShError
  89.  
  90. CLS
  91. '----- Display the information returned
  92. PRINT
  93. PRINT "  Program Version: "; Info(1) / 100
  94. PRINT "        File Type: ";
  95. IF Info(2) = 0 THEN PRINT "Standard Help" ELSE PRINT "EXE File"
  96.  
  97. PRINT
  98. PRINT "  Number of screens: "; Info(3)
  99. PRINT "    Number of links: "; Info(4)
  100. PRINT
  101.  
  102. IF Info(0) THEN
  103.    PRINT
  104.    PRINT "  Information on Screen number: "; Info(0)
  105.    PRINT
  106.    PRINT "     Top line of window: "; Info(5)
  107.    PRINT "  Left column of window: "; Info(6)
  108.    PRINT "        Lines in window: "; Info(7)
  109.    PRINT "        Width of window: "; Info(8)
  110.    PRINT "               Box type: "; Info(9)
  111.    PRINT "                 Shadow: "; Info(10)
  112.    PRINT "        Number of links: "; Info(11)
  113.    PRINT "           Auto linking: "; Info(12)
  114.    PRINT "              Box color: "; Info(13)
  115.    PRINT "             Text color: "; Info(14)
  116.    PRINT "             Link color: "; Info(15)
  117. END IF
  118.  
  119. COLOR 7, 0
  120. END
  121.  
  122.  
  123. GetCh:
  124.    a$ = INPUT$(1)
  125.    IF a$ = CHR$(27) THEN END
  126. RETURN
  127.  
  128.  
  129. BackScrn:
  130.    CLS
  131.    COLOR 1, 7
  132.    PRINT STRING$(1999, 177);
  133.  
  134. ClearMiddle:
  135.    FOR i = 1 TO 5
  136.       LOCATE 10 + i, 15
  137.       PRINT SPACE$(50);
  138.    NEXT
  139.    LOCATE 13, 17, 1
  140. RETURN
  141.  
  142.  
  143. ShError:
  144.    COLOR 7, 0
  145.    CLS
  146.    PRINT "An error has occured within a Simply Help! routine. "
  147.    PRINT
  148.    SELECT CASE Er
  149.       CASE -1
  150.          PRINT "Invalid help file"
  151.       CASE -2
  152.          PRINT "Invalid screen number"
  153.       CASE -3
  154.          PRINT "Not enough elements"
  155.       CASE ELSE
  156.          PRINT "BASIC error code:"; Er
  157.    END SELECT
  158. END
  159.  
  160.