Limiting The Length Of(1)

 BBS: Inland Empire Archive
Date: 02-16-93 (13:44)             Number: 186
From: JASON BELLFLOWERS            Refer#: NONE
  To: RUSTY GORDON                  Recvd: NO  
Subj: Limiting The Length Of(1)      Conf: (2) Quik_Bas
I believe this is the information you require....
I know it is very healthy and if you figure out a way to reduce it's
size, please let me know.  This was written by a good friend of mine
when it came time for me to write a program that required this....

DECLARE FUNCTION Limin$ (xp!, yp!, prompt$, out$, ln!, phue!, ihue!, limhue!)
FUNCTION Limin$ (xp, yp, prompt$, out$, ln, phue, ihue, limhue)

'Where xp=The row you want the prompt to be on
'Where yp=The coloumn you want the prompt to be on
'Where prompt$=Well, the prompt
'Where out$=The string name you want the output to go to
'Where ln=The length of the answer bars to spread out
'Where phue=The color of the prompt
'Where ihue=The color of the "Bars"
'Where limhue=The color of the answer


COLOR phue
LOCATE xp, yp: PRINT prompt$
COLOR ihue

x = LEN(prompt$)
yp = yp + x
y = 0
z = 1
b$ = CHR$(177) 'This is the prompt character ( )
tt = yp + ln
s = yp

DO UNTIL s = tt
  LOCATE xp, s: COLOR limhue: PRINT b$: COLOR 7, 0 'color and print the reply
  s = s + 1
LOOP

DO UNTIL y = ln
LOCATE xp, yp
a$ = INKEY$
   SELECT CASE a$

      CASE IS = "", CHR$(0) TO CHR$(7), CHR$(9) TO
CHR$(12), CHR$(14) TO CHR$(30
      CASE IS = CHR$(13)
         GOTO done
      CASE IS = CHR$(8)
         SELECT CASE inname$
            CASE IS = ""
            CASE ELSE
               rest = LEN(inname$) - 1
               inname$ = LEFT$(inname$, rest)
               y = y - 1
               yp = yp - 1
               LOCATE xp, yp: PRINT CHR$(177)
         END SELECT
      CASE ELSE
         inname$ = inname$ + a$
         LOCATE xp, yp: PRINT a$
         yp = yp + 1
         y = y + 1
   END SELECT
addanotherletter:

LOOP

lastletter:

in$ = INKEY$

SELECT CASE in$

   CASE IS = CHR$(13)
      GOTO done
   CASE IS = CHR$(8)
      SELECT CASE inname$
         CASE IS = ""
         CASE ELSE
            rest = LEN(inname$) - 1
            inname$ = LEFT$(inname$, rest)
            y = y - 1
            yp = yp - 1
            LOCATE xp, yp: PRINT CHR$(177)
      END SELECT
   GOTO addanotherletter
   CASE ELSE
      GOTO lastletter
END SELECT

done:

s = yp

     --==<<< Continued next message >>>==--

--- RBBSMail v18.2
 * Origin: PowerPlex Plaza, Valdosta GA (1:3645/20.0)
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