home *** CD-ROM | disk | FTP | other *** search
- ; Script: BOARD.SC
- ; Version: 3.5
- ; Date: 23 March 1990
- ;
- ; The procedures in this script handle the display of the "main board,"
- ; the table of stocks shown with real-time updates. Since the table may
- ; be larger than one display screen in length, it is shown in "pages,"
- ; with each page being displayed for a short period of time before moving
- ; on to the next page.
- ;
- ; SeeBoard is the main procedure here, and controls the initial display
- ; of the "main board." It uses the ShowNSleep procedure to display
- ; additional pages of the board, if any.
-
- PROC CLOSED SeeBoard()
- PRIVATE NStocks, NScreens, i
-
- CLEARALL ; make sure that the workspace is clear
- VIEW "Price" ; Main Board consists of the Price table shown in real time
- MOVETO [Chg]
- MOVETO [Ticker] ; position cursor so that Ticker is first field showing
- ECHO NORMAL
- PROMPT "Real-time stock feed.", "Press any key to quit."
- NStocks = NRECORDS("Price") ; How many stocks to display?
- IF (MOD(NStocks, 22) <> 0) ; we can fit 22 stocks on a screen
- THEN NScreens = INT(NStocks / 22) + 1 ; need extra screen for spillover
- ELSE NScreens = NStocks / 22 ; no spillover stocks
- ENDIF
-
- WHILE (NOT CHARWAITING()) ; if user types anything, leave
- IF (NScreens > 1) ; only use ShowNSleep if more than 1 screen
- THEN
- ShowNSleep("Down", NScreens)
- ShowNSleep("Up", NScreens)
- ELSE SleepRefresh() ; update the information on single screen
- ENDIF
- ENDWHILE
-
- ; To get here, user must have typed a character.
-
- ECHO OFF ; no more updating needed
- i = GETCHAR() ; gobble up the character typed
- CLEARALL ; clear the workspace
- ENDPROC
-
- ; ShowNSleep steps through the Main Board screens one at a time,
- ; using SleepRefresh to pause and refresh the information displayed.
-
- PROC ShowNSleep(Direction, TotScreen)
- FOR i FROM 1 TO TotScreen - 1 ; For each screen we have to display:
- IF (CHARWAITING()) ; make sure user didn't ask to leave,
- THEN RETURN
- ENDIF
- SleepRefresh() ; display and update the information,
- IF (Direction = "Up")
- THEN PGUP ; move to previous page if we're heading back,
- ELSE PGDN ; move to next page if we're heading forward,
- ENDIF
- ENDFOR
- ENDPROC
-
- ; SleepRefresh performs a 3-second SLEEP with an explicit table refresh
- ; in the middle of the period.
-
- PROC SleepRefresh()
- SLEEP 1500 ; pause for 1.5 seconds
- REFRESH ; force an update of the information
- SLEEP 1500 ; pause for 1.5 more seconds
- ENDPROC
-