Page 1 of 1

How To Refresh() TITLETEXT With Arrays...???

Posted: Mon May 25, 2020 3:33 pm
by RiazKhan
I have a dbf file with values (as character) which is auto-updated every ten minutes. The update changes values and needs to be refreshed/overwritten on the screen. A timer updates this screen with new values.

I save the values as text in the dbf and update the array and refresh the array as SETTEXT method.
But this does not refresh the screen but instead writes the vales over the previous values. Thus smudging the screen as unreadable.

I re-initialize the array and update it.

Is there another way to handle this.....
Also I need to have all figures as right-justified...??

My source is as below....

*---------------------------------------------------------------------------
STATIC FUNCTION DTop_AAAA()
*---------------------------------------------------------------------------
LOCAL xCnt,oDlg , oOpt1 , nOpt1,lFirst := .T.
LOCAL nX,nY,tX,tY
Local n:=0
LOCAL Scrn_W := ScreenWidth() // 1366
LOCAL Scrn_H := ScreenHeight() // 716
Local oLen_Head,dDAte
Local oLen7,oLen6,oLen5
LOCAL oDash_T,oTime_AA
LOCAL t := 1

// Open File

If ! Open_File(.F.,'P6_AAAA')
Return (Nil)
Endif

aSize(aVar_AA , 0 ) ; aSize(oVar_AA , 0 )

// initlize array

For t = 1 To P6_AAAA->(RecCount()) // Initlize Array
aAdd( aVar_AA,{ '','','','' })
aAdd( oVar_AA,{ '','','','' })
Next t

t := 1 ; P6_AAAA->(DbGoTop())

// Assign variables to array

Do While !Eof() // Assign variable to array
If lFirst
oVar_AA[t,01] := aVar_AA[t,01] := "Last Update : "+Left(Time(),5)
oVar_AA[t,02] := aVar_AA[t,02] := PadL(CDoW(CToD(AllTrim(P6_AAAA->CDay_07))),17)
oVar_AA[t,03] := aVar_AA[t,03] := PadL(CDoW(CToD(AllTrim(P6_AAAA->CDay_06))),17)
oVar_AA[t,04] := aVar_AA[t,04] := PadL(CDoW(CToD(AllTrim(P6_AAAA->CDay_05))),17)
lFirst := .F.
Else
oVar_AA[t,01] := aVar_AA[t,01] := P6_AAAA->Group
oVar_AA[t,02] := aVar_AA[t,02] := P6_AAAA->CDay_07
oVar_AA[t,03] := aVar_AA[t,03] := P6_AAAA->CDay_06
oVar_AA[t,04] := aVar_AA[t,04] := P6_AAAA->CDay_05
Endif
t++ ; P6_AAAA->(DbSkip())
Enddo

tX := 15 ; tY := 20
nX := 225 ; nY := 0

// Header

@ 0,nY TITLE oBar_AA Size 480, 28 Of oMainWnd TRANSPARENT
oBar_AA:lRound := .T.
@ 10, nY TITLETEXT OF oBar_AA TEXT " Daily Analysis" COLOR 16711680 FONT oDash_F

// Making Box

@ 30, nY TITLE oBar_AA Size 150, 430 of oMainWnd TRANSPARENT // SHADOWSIZE 15 // BOTTOMRIGHT
@ 30, nY TITLE oBar_AA Size 260, 430 of oMainWnd TRANSPARENT // SHADOWSIZE 15 // BOTTOMRIGHT
@ 30, nY TITLE oBar_AA Size 370, 430 of oMainWnd TRANSPARENT // SHADOWSIZE 15 // BOTTOMRIGHT
@ 30, nY TITLE oBar_AA Size 480, 430 of oMainWnd TRANSPARENT // SHADOWSIZE 15 // BOTTOMRIGHT

oBar_AA:lBorder := .T.
oBar_AA:nShadowIntensity = 20
oBar_AA:lRound := .T.

n:= 0

// Draw horizontal lines

For t = 1 To Len(aVar_AA)
@ tX+n+3,tY TITLETEXT OF oBar_AA TEXT "_________________________________________________" COLOR 0 FONT oMainFont
n += 20
Next t

t := 1 ; n:= 0 ; lFirst := .T.

// Display Figures

For t = 1 To Len( aVar_AA )

If lFirst
@ tX+n,tY TITLETEXT oVar_AA[t,01] OF oBar_AA TEXT aVar_AA[t,01] COLOR 0 FONT oDash_M
@ tX+n,tY+150 TITLETEXT oVar_AA[t,02] OF oBar_AA TEXT aVar_AA[t,02] COLOR 0 FONT oDash_M
@ tX+n,tY+250 TITLETEXT oVar_AA[t,03] OF oBar_AA TEXT aVar_AA[t,03] COLOR 0 FONT oDash_M
@ tX+n,tY+350 TITLETEXT oVar_AA[t,04] OF oBar_AA TEXT aVar_AA[t,04] COLOR 0 FONT oDash_M

lFirst := .F.
Else

@ tX+n,tY TITLETEXT oVar_AA[t,01] OF oBar_AA TEXT aVar_AA[t,01] COLOR 0 FONT oDash_M
@ tX+n,tY+150 TITLETEXT oVar_AA[t,02] OF oBar_AA TEXT aVar_AA[t,02]
@ tX+n,tY+250 TITLETEXT oVar_AA[t,03] OF oBar_AA TEXT aVar_AA[t,03]
@ tX+n,tY+350 TITLETEXT oVar_AA[t,04] OF oBar_AA TEXT aVar_AA[t,04] COLOR 0 FONT oMainFont

Endif

n += 20

Next t

P6_AAAA->(DbCloseArea())

Return ( Nil )
********************************************

Now after ten minutes the figures need to be refreshed.....


Image

Re: TITLETEXT Refresh() How To DO.....

Posted: Thu May 28, 2020 2:36 pm
by MGA
oTitle:aText[1,3] := ''test"
oTitle:Refresh()

Re: TITLETEXT Refresh() How To DO.....

Posted: Fri May 29, 2020 3:47 pm
by RiazKhan
Thanks,
Tried that, but did not work.