GETTREE.BAS 2/2

 BBS: Inland Empire Archive
Date: 12-01-92 (05:19)             Number: 344
From: JERRY ALDRICH                Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: GETTREE.BAS  2/2               Conf: (2) Quik_Bas
---------------------- CONTINUED FROM LAST MESSAGE ----------------------
SUB ShowTree
CLS : S = 1: Top = 1: IF DCnt < 22 THEN Max = DCnt - 1 ELSE Max = 22
Refresh:
OldN = 0: N = 0
FOR I = Top TO Top + Max
  P$ = Path$(I): N = 0: P = 0
  DO
    W = INSTR(W + 1, P$, "\"): IF W THEN P = W: N = N + 1
  LOOP WHILE W
  P2$ = Path$(I + 1): N2 = 0: P2 = 0
  DO
    W = INSTR(W + 1, P2$, "\"): IF W THEN P2 = W: N2 = N2 + 1
  LOOP WHILE W
  Nof$ = LEFT$(RIGHT$(P$, LEN(P$) - P) + SPACE$(20), 20)
  IF INSTR(Nof$, ":") THEN
    LOCATE I, S: PRINT LEFT$("\" + SPACE$(20), 20)
  ELSE
    T$ = "": FOR J = 1 TO N - 1: T$ = "  " + T$: NEXT
    IF N2 < N THEN T$ = T$ + "" ELSE T$ = T$ + ""
    LOCATE I - Top + 1, S: PRINT T$ + "";
    PRINT Nof$
  END IF
NEXT
DO: K$ = INKEY$: LOOP UNTIL LEN(K$)
IF LEN(K$) = 1 THEN K = ASC(K$) ELSE K = -ASC(RIGHT$(K$, 1))
SELECT CASE K
  CASE 27
    CLS : EXIT SUB
  CASE -80
    Top = Top + 1
  CASE -72
    Top = Top - 1
  CASE -73
    Top = Top - 19
  CASE -81
    Top = Top + 19
END SELECT
IF Top < 1 THEN Top = 1
IF Top + Max > DCnt THEN Top = DCnt - Max
GOTO Refresh

END SUB
------------------------------- CUT HERE --------------------------------

This Sub is to display the directory tree created by the previous sub.
It ain't much, but it works.

Any suggestions or comments about improving the speed would be greatly
appreciated!

Have fun with it!
Jerry Aldrich

--- Renegade v8-27 Beta
 * Origin: The Bumpkinland BBS - "Home of BLand Software" (1:296/3)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET