QB / QB64 Discussion Forum      Other Subforums, Links and Downloads
Respond to this messageReturn to Index
Original Message
  • Updated continuous scroll with option to stop & start.
    • Solitaire (Login Solitaire1)
      S
      Posted Jan 23, 2010 12:33 PM

      I added a STATIC Boolean variable to allow any key to start or stop the message from scrolling. It will scroll continuously, restarting from the beginning when done.


      DECLARE SUB Scroll (msg AS STRING, E AS STRING)
      DIM msg AS STRING, E AS STRING
      msg$ = ">> This is a very long message that will scroll around. It will serve as instruction for using a software program and should stay on the bottom line.   "
      CLS
      LOCATE 25, 1
      PRINT LEFT$(msg$, 80);
      DO
          LOCATE 1, 1
          PRINT "Press any key to start or stop the scrolling instruction line; Esc to end"
          E$ = INPUT$(1)
          IF E$ <> CHR$(27) THEN CALL Scroll((msg$), E$)
      LOOP UNTIL E$ = CHR$(27)
      SYSTEM

      SUB Scroll (msg AS STRING, E AS STRING)
      DIM startmsg AS STRING
      DIM N AS INTEGER
      N = LEN(msg)
      DIM ch AS STRING
      DIM circuit AS INTEGER
      STATIC onoff AS INTEGER
      circuit = 0
      startmsg$ = msg$
      VIEW PRINT 25 TO 25
      DO
          circuit = circuit + 1
          ch = MID$(msg$, 1, 1)
          msg$ = MID$(msg$, 2, N - 1) + ch
          PRINT LEFT$(msg$, 80);
          pause = .1
          t = TIMER
          DO WHILE t + pause >= TIMER: LOOP
          E$ = INKEY$
          IF E$ <> CHR$(27) AND E$ <> "" THEN
              onoff = NOT onoff
              IF onoff = -1 THEN SLEEP
          END IF
          IF circuit = N - 80 THEN circuit = 0
      LOOP UNTIL E$ = CHR$(27)
      VIEW PRINT
      CLS
      END SUB

    Login Status
  • You are not logged in
    • Login
      Password
       

      Optional
      Provides additional benefits such as notifications, signatures, and user authentication.


      Create Account
    Your Name
    Your Email
    (Optional)
    Message Title
    Message Text
    Options Also send responses to my email address
          


    Newbies usually go to www.qbasic.com and click on The QBasic Forum
    Forum regulars have their own ways, which include The QBasic Community Forums