Scrolling Text
-
- Posts: 254
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Scrolling Text
I am attemption on displaying scrolling text (horizontally) on my window. When I do it, the text seems to flash sometimes. Is there a way to do this in a very smooth way, more appealing?
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
-
- Posts: 254
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Scrolling Text
Antonio,
I just pulled this out of the much larger program. You can at least see how we are doing it. If there is a better way, please let us know.
Thanks,
Byron...
Source Below
FUNCTION SAVEYESADVERTISE(lENABLE)
LOCAL oINI
LOCAL cINIFILE:=MCS_ININAME()
LOCAL cENABLE:=IIF(lENABLE,"YES","NO")
//
INI oIni FILE cIniFile
SET SECTION "Advertisements" ENTRY "EnableAdvertise" TO cENABLE OF oINI
ENDINI
RETURN NIL
FUNCTION GETYESADVERTISE()
LOCAL cINIFILE:=MCS_ININAME()
LOCAL oINI
LOCAL cRV
LOCAL lRV:=.F.
INI oIni FILE cIniFile
GET cRV SECTION "Advertisements" ENTRY "EnableAdvertise" DEFAULT "NO" OF oIni
ENDINI
lRV:=IIF(cRV=="YES",.T.,.F.)
RETURN lRV
FUNCTION CHKADVERTISE()
IF lADVERTISE
SCROLLNOW()
ENDIF
RETURN NIL
FUNCTION SCROLLMESSAGE(cMESSAGE)
LOCAL hDC
LOCAL nOldFont
LOCAL hPen
LOCAL hOldPen
IF lADVERTISE
* hDC:=oSCROLLBMP:hDC
* SetBkMode(hDC, TRANSPARENT)
* TextOut(hDC, 5, 100,cMESSAGE)
nSCROLLCOL+=5
IF nSCROLLCOL > 1300
nSCROLLCOL:=-500
ENDIF
hDC := oSCROLLBMP:hDC
nOldFont := SelectObject(hDC,oSCROLLFont:hFont)
hPen := CreatePen(0,0,CLR_RED)
hOldPen := SelectObject(hDC,hPen)
SETTEXTCOLOR(hDC,CLR_RED)
SetBkMode(hDC, TRANSPARENT )
TextOut(hDC,8,nSCROLLCOL,cMESSAGE,Len(cMESSAGE))
//
SelectObject(hDC,nOldFont)
SelectObject(hDC,hOldPen)
DeleteObject(hPen)
ENDIF
RETURN NIL
FUNCTION SCROLLNOW()
IF lADVERTISE
// oSCROLLBMP:REFRESH(.F.)
IF oSCROLLSAY <> NIL
nSCROLLCOL-=4
IF nSCROLLCOL < nSTARTCOL
nSCROLLCOL:=1280
ENDIF
oSCROLLSAY:Move(980,nSCROLLCOL,1280,50,.F.)
oSCROLLSAY:REFRESH(.F.)
ENDIF
ENDIF
RETURN NIL
FUNCTION SCROLLTIMER()
nSCROLLCTR:=0
DEFINE TIMER oSCROLLTIMER OF oWND ;
INTERVAL 60 ;
ACTION (nSCROLLCTR++,CHKADVERTISE())
ACTIVATE TIMER oSCROLLTIMER
RETURN NIL
FUNCTION GETSTARTCOL(cMESSAGE)
LOCAL nRV :=0
nRV :=GETTEXTWIDTH(0,cMESSAGE,oSCROLLFONT:hFONT)
RETURN nRV
I just pulled this out of the much larger program. You can at least see how we are doing it. If there is a better way, please let us know.
Thanks,
Byron...
Source Below
FUNCTION SAVEYESADVERTISE(lENABLE)
LOCAL oINI
LOCAL cINIFILE:=MCS_ININAME()
LOCAL cENABLE:=IIF(lENABLE,"YES","NO")
//
INI oIni FILE cIniFile
SET SECTION "Advertisements" ENTRY "EnableAdvertise" TO cENABLE OF oINI
ENDINI
RETURN NIL
FUNCTION GETYESADVERTISE()
LOCAL cINIFILE:=MCS_ININAME()
LOCAL oINI
LOCAL cRV
LOCAL lRV:=.F.
INI oIni FILE cIniFile
GET cRV SECTION "Advertisements" ENTRY "EnableAdvertise" DEFAULT "NO" OF oIni
ENDINI
lRV:=IIF(cRV=="YES",.T.,.F.)
RETURN lRV
FUNCTION CHKADVERTISE()
IF lADVERTISE
SCROLLNOW()
ENDIF
RETURN NIL
FUNCTION SCROLLMESSAGE(cMESSAGE)
LOCAL hDC
LOCAL nOldFont
LOCAL hPen
LOCAL hOldPen
IF lADVERTISE
* hDC:=oSCROLLBMP:hDC
* SetBkMode(hDC, TRANSPARENT)
* TextOut(hDC, 5, 100,cMESSAGE)
nSCROLLCOL+=5
IF nSCROLLCOL > 1300
nSCROLLCOL:=-500
ENDIF
hDC := oSCROLLBMP:hDC
nOldFont := SelectObject(hDC,oSCROLLFont:hFont)
hPen := CreatePen(0,0,CLR_RED)
hOldPen := SelectObject(hDC,hPen)
SETTEXTCOLOR(hDC,CLR_RED)
SetBkMode(hDC, TRANSPARENT )
TextOut(hDC,8,nSCROLLCOL,cMESSAGE,Len(cMESSAGE))
//
SelectObject(hDC,nOldFont)
SelectObject(hDC,hOldPen)
DeleteObject(hPen)
ENDIF
RETURN NIL
FUNCTION SCROLLNOW()
IF lADVERTISE
// oSCROLLBMP:REFRESH(.F.)
IF oSCROLLSAY <> NIL
nSCROLLCOL-=4
IF nSCROLLCOL < nSTARTCOL
nSCROLLCOL:=1280
ENDIF
oSCROLLSAY:Move(980,nSCROLLCOL,1280,50,.F.)
oSCROLLSAY:REFRESH(.F.)
ENDIF
ENDIF
RETURN NIL
FUNCTION SCROLLTIMER()
nSCROLLCTR:=0
DEFINE TIMER oSCROLLTIMER OF oWND ;
INTERVAL 60 ;
ACTION (nSCROLLCTR++,CHKADVERTISE())
ACTIVATE TIMER oSCROLLTIMER
RETURN NIL
FUNCTION GETSTARTCOL(cMESSAGE)
LOCAL nRV :=0
nRV :=GETTEXTWIDTH(0,cMESSAGE,oSCROLLFONT:hFONT)
RETURN nRV
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
-
- Posts: 254
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Scrolling Text
Antonio,
I will post a small working example in a few minutes.
Thanks,
Byron...
I will post a small working example in a few minutes.
Thanks,
Byron...
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
if what you want he is to do scroll of a dinamicos text uses the class of says already exists and I use :
REDEFINE DYNAMIC SAY ::oSayDinamic VAR AllTrim(oLoterWin:cMensajeBanner) ID 393 OF oDlgLot;
HORIZONTAL SCROLL WRAP;
RIGHT SHADED;
COLOR CLR_WHITE, CLR_BLUE FONT oFont3
this class Dsay is of Ramon Avendaño.
REDEFINE DYNAMIC SAY ::oSayDinamic VAR AllTrim(oLoterWin:cMensajeBanner) ID 393 OF oDlgLot;
HORIZONTAL SCROLL WRAP;
RIGHT SHADED;
COLOR CLR_WHITE, CLR_BLUE FONT oFont3
this class Dsay is of Ramon Avendaño.
Mario Antonio González Osal
Venezuela
m a g 0 7 1 @ g m a i l. c o m
Venezuela
m a g 0 7 1 @ g m a i l. c o m