Scrolling Text

Scrolling Text

Postby byron.hopp » Mon May 22, 2006 10:29 pm

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
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Postby Antonio Linares » Mon May 22, 2006 11:24 pm

Byron,

How are you doing it ? Please show us the code.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Scrolling Text

Postby byron.hopp » Tue May 23, 2006 12:29 am

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
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Scrolling Text

Postby byron.hopp » Tue May 23, 2006 12:35 am

Antonio,

I will post a small working example in a few minutes.

Thanks,

Byron...
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 382
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Postby mag071 » Tue May 23, 2006 2:19 am

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.
Mario Antonio González Osal
Venezuela
m a g 0 7 1 @ g m a i l. c o m
User avatar
mag071
 
Posts: 140
Joined: Thu Feb 02, 2006 12:09 pm
Location: Venezuela


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests