home *** CD-ROM | disk | FTP | other *** search
- ; Script: TICKER.SC
- ; Version: 3.5
- ; Date: 23 March 1990
- ;
- ; TICKER contains the procedures that create a "tickertape" display of
- ; the stocks in the PRICE table.
-
- PROC AddChar(s) ; add the next characters and display ticker
- PRIVATE l, i
- l = LEN(s) ; Find out how many character added to string
- FOR i FROM 1 TO l ; so that we loop right number of times.
- ToPrint = SUBSTR(ToPrint, 2, 50) + SUBSTR(s, i, 1)
- @ 12, 15 ; add char to ticker line
- ?? ToPrint ; print ticker string on line 12
- SLEEP Delay ; short pause, otherwise ticker moves too fast
- ENDFOR
- ENDPROC
-
- PROC TickerTape()
- PRIVATE ToPrint, x, Delay, BetweenRefresh
- ToPrint = SPACES(80)
- Delay = 100
- BetweenRefresh = 5
- VIEW "Price" ; get ticker info from PRICE table
- WHILE (True) ; loop until user presses character
- SCAN ; use SCAN to move through stocks in table
- IF (CHARWAITING()) ; Did user press a key?
- THEN
- x = GETCHAR() ; yes, so let's see what they typed
- WHILE (CHARWAITING())
- Y = GETCHAR()
- ENDWHILE
- SWITCH
- CASE x = 45: ; user typed minus
- Delay = Delay + 50 ; so slow the ticker
- CASE x = 43: ; user typed plus
- Delay = MAX(Delay - 50, 0) ; so speed up ticker
- OTHERWISE: ; user wants to leave
- CLEARALL ; so clear up the workspace and
- RETURN ; go back to Main menu
- ENDSWITCH
- ENDIF ; no, so continue SCAN
- IF (MOD(RECNO(),BetweenRefresh) = 1)
- THEN REFRESH ; refresh every BetweenRefresh records
- ENDIF
- AddChar([Ticker] + " " + STRVAL([Price]) + " ")
- ; add stock name and price to ticker
- ENDSCAN
- ENDWHILE
- ENDPROC ; TickerTape
-
- ; DoTicker is the controlling procedure and performs a few housekeeping
- ; chores before calling the routine to display stock information.
-
- PROC CLOSED DoTicker()
- CLEAR ; clear PAL canvas for ticker
- CURSOR OFF ; Cursor not needed in this subsystem
- PAINTCANVAS ATTRIBUTE 0 12, 14, 14, 70 ; for shadow box
- PAINTCANVAS FILL (" ") 12, 13, 13, 67 ; clear window
- PAINTCANVAS BORDER FILL " " ATTRIBUTE 78 11, 12, 13, 68 ; for frame
- TickerTape() ; start the tape
- CLEAR ; remove ticker from display before returning to Main menu
- ENDPROC
-
-