home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / basic / QBA201.ZIP / DIRDEMO.BAS < prev    next >
Encoding:
BASIC Source File  |  1992-12-31  |  2.5 KB  |  127 lines

  1.  
  2. 'This program demostrates one method of implementing the scrolling features
  3. 'of QBAccel(Tm) together with other functions found in the QBAccel
  4. 'library for QuickBASIC(tm) 4.5 from Microsoft(r).
  5.  
  6. '...................................c o d e...................................
  7.  
  8. 'create screen
  9. PCOPY 0, 1
  10.  
  11. COLOR 14, 0, 0: CLS
  12. CALL Ticks(18)
  13. CALL left2rite(10, 0, 14, "QBAccel(Tm) Library Scrolling Demo 1.02")
  14. CALL Ticks(9)
  15. CALL left2rite(12, 0, 14, "Copyright(c)1992 Crady vonPawlak")
  16. CALL Ticks(9)
  17. CALL left2rite(14, 0, 14, "This program is most effective run in large directories")
  18. CALL Ticks(9)
  19. CALL left2rite(16, 0, 14, "Press any key to begin...")
  20.  
  21. DO: LOOP WHILE INKEY$ = ""
  22.  
  23. COLOR 11, 4: CLS
  24. DEFINT A-Z
  25.     up$ = CHR$(0) + CHR$(72)
  26.     dn$ = CHR$(0) + CHR$(80)
  27.  
  28.  
  29.  cc = (16 * 1) + 15
  30.  
  31. LOCATE 4, 20: COLOR 11, 1: PRINT "Press "; CHR$(24); " "; CHR$(25); " "; "keys to scroll. [ Esc ] to exit.";
  32.  
  33. 'put a listing of all files in the current directory where we can get them
  34. d$ = "*.*"
  35. SHELL "dir *.* > dir.~~~"
  36. DIM dir$(200), d$(200)
  37. OPEN "dir.~~~" FOR INPUT AS #1
  38.  
  39. DO UNTIL EOF(1)
  40.   
  41.  a = a + 1
  42.  IF a > 200 THEN EXIT DO
  43.  LINE INPUT #1, d$(a)
  44.  test$ = LEFT$(d$(a), 1)
  45.  
  46.  IF test$ = "" OR test$ = " " OR test$ = "." THEN
  47.     GOTO notfile
  48.     ELSE total = total + 1: dir$(total) = LEFT$(d$(a), 12)
  49.  END IF
  50. notfile:
  51.  LOOP
  52.  CLOSE #1
  53.  
  54. 'create another window
  55. CALL GroWindow(33, 46, 5, 13, 2, 1, "r", 1, 11, 1, "", 1, 0, 1, 0)
  56.  COLOR 15, 1
  57.  FOR s = 1 TO 7
  58.  
  59. 'use ZIPRINT for FAST screen printing
  60.  LOCATE s + 5, 34: CALL ziPRINT(dir$(s), cc)
  61.  NEXT
  62.  
  63. CALL wipekbd
  64.  DO
  65.  k$ = INKEY$
  66.  IF k$ = CHR$(27) THEN EXIT DO
  67.  
  68.  IF k$ = up$ THEN GOSUB up
  69.  IF k$ = dn$ THEN GOSUB Down
  70.  LOOP
  71.  
  72. 'restore the screen page and exit
  73.  SHELL "del dir.~~~"
  74.  CALL Curtains(1)
  75.  
  76.  END: ' End demo.
  77.  
  78. 'do the actual up/down scrolling of the disk directory
  79. up:
  80.   IF start = 0 THEN
  81.     up = s
  82.     start = 1
  83.     uptest = 1
  84.   GOTO doUp
  85.  END IF
  86.   IF uptest = 0 THEN
  87.     up = dn + 7
  88.     uptest = 1
  89.     ELSE up = up + 1
  90.   END IF
  91.   IF up > total THEN
  92.     up = total
  93.     BEEP
  94.     RETURN
  95.   END IF
  96.   
  97.  
  98. doUp:
  99.   CALL scrollup(1, 31, 5, 33, 11, 44)
  100.   LOCATE 12, 34: CALL ziPRINT(dir$(up), cc)
  101.   dn = up - 7
  102. RETURN
  103.  
  104. Down:
  105.   IF start = 0 THEN
  106.      BEEP
  107.      RETURN
  108.   END IF
  109.   IF uptest = 1 THEN
  110.     dn = up - 7: uptest = 0
  111.     ELSE dn = dn - 1
  112.   END IF
  113.  
  114.   IF dn <= 1 THEN
  115.     dn = 1
  116.     start = 0
  117.     BEEP
  118.   END IF
  119.     CALL scrolldn(1, 31, 5, 33, 11, 44)
  120.     LOCATE 6, 34: CALL ziPRINT(dir$(dn), cc)
  121.     up = dn + 7
  122. RETURN
  123.  
  124.  
  125.  
  126.  
  127.