TScrollMsg
Source: source/classes/scrolmsg.prg
Inherits from: TPanel
TScrollMsg is an auto-scrolling marquee text control. It continuously scrolls text either horizontally (ticker-tape style) or vertically (scrolling credits style). A timer drives incremental pixel scrolling, and the text wraps around seamlessly when it reaches the end. It supports configurable speed, colors, borders, and runtime text updates.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
cText | Character | The text to scroll (read-only, use SetText() to update) |
lVertical | Logical | Vertical scrolling when .T. (default), horizontal when .F. |
nSpeed | Numeric | Scroll speed in pixels per tick (default 2) |
lBorder | Logical | Draw a border around the control (default .T.) |
nScrollPix | Numeric | Current pixel scroll offset (protected) |
nTextSize | Numeric | Cached text dimension for wrap calculation (protected) |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, nW, nH, cText, oWnd, oFont, nSpeed, nClrText, nClrBack, lHoriz, lPixels, lDesign, cVarName, lNoBorder ) | Create a new TScrollMsg marquee control |
SetText( cText ) | Change the scrolling text at runtime and restart scroll |
Example: Horizontal Marquee
#include "FiveWin.ch"
function Main()
local oWnd, oScroll
DEFINE WINDOW oWnd TITLE "News Ticker" SIZE 600, 100
oScroll := TScrollMsg():New( 10, 10, 560, 30,;
"Breaking news: FWH 26.05 released!",;
oWnd,, 3, CLR_YELLOW, CLR_BLUE, .T., .T. )
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- The marquee timer interval is fixed at 18 ms (approximately 55 fps). Adjust
nSpeed(pixels per tick) to control the effective scroll velocity. - When scrolling vertically, text wraps using
DT_WORDBREAK. Horizontal scrolling uses a single line withDT_SINGLELINE. - Pass
lHoriz := .T.to enable horizontal scrolling; the default is vertical. - The control automatically creates and activates its timer on first paint and destroys it on
Destroy(). - Set
lNoBorder := .T.to suppress the surrounding box outline.