home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- «MDSD»«MDNM»* BANNER()
- *
- * Displays a moving line of quotes or other information that
- * runs until the user presses a key. It then returns the
- * INKEY() value of the key to the calling program.
- *
- *** nRow = The starting row of the banner.
- *** nCol = The starting column of the banner.
- *** cString = The string (any "practical" length) to be
- *** displayed.
- *** nLgth = The width of the banner window.
- *** lBeep = .T. : Beep as characters are shoved into
- the stream.
- .F. : No beep.
- *
- *** The rate of the data stream can be altered by changing
- *** the INKEY() value.
- *** Written for use with Clipper 5.0. Can be used with other
- *** Xbase products if LOCAL declarations are replaced with
- *** PRIVATEs and the ":=" operator is replaced with "=."
- *****************************************************************
-
- *** Sample use follows:
- ***********************
- cPasStrng:="Common sense is the most widely shared commodity " +;
- "in the world, for every man is convinced that he " +;
- "is well supplied with it. - Descartes ... A great " +;
- part of courage is the courage of having done the " +;
- thing before. - Ralph Waldo Emerson ... "
-
- nRetVal := BANNER(24,1,cPasStrg,80)
-
- RETURN
-
- *****************************************************************
- FUNCTION BANNER
- *****************************************************************
- local cSaystring,keypress
- PARAMETERS nRow, nCol, cString, nLgth, lBeep
- IF EMPTY(nLgth)
- nLgth:=80
- ENDIF
- IF EMPTY(nRow)
- nRow:=24
- ENDIF
- IF EMPTY(lBeep)
- lBeep:=.F.
- ENDIF
- keypress:=0
- DO WHILE .T. && Display until a key is pressed
- FOR i = 1 to len(cString) && Increment through the entire string
- *****Establish the display window
- cSaystring:=IIF(nLgth < (LEN(cString)-i), ;
- SUBSTR(cString,i,nLgth),SUBSTR(cString,i,(len(cString)-i)) + ;
- SUBSTR(cString,1, i-1))
- IF ISCOLOR()
- SETCOLOR("N/W+")
- ELSE
- SET COLOR TO I && Reverse out the banner
- ENDIF
- @ nRow , nCol SAY cSaystring && Display the banner
-
- SET COLOR TO && Reset the colors
-
- keypress:=INKEY(.08) && Wait for a keystroke
- IF lBeep
- tone(30,.1)
- ENDIF
- IF keypress # 0
- RETURN keypress && Return the key pressed
- ENDIF
-
- NEXT
- ENDDO