TITLETEXT Refresh() Arrays...(SOLVED)
Posted: Sat Jun 06, 2020 7:33 am
I have a dbf file with values (as characters) 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 to unreadable.
I re-initialize the array and update it, with fresh values.
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
@ 10, nY TITLETEXT OF oBar_AA TEXT " Daily Analysis"
// Making Box
@ 30, nY TITLE oBar_AA Size 150, 430 of oMainWnd TRANSPARENT
@ 30, nY TITLE oBar_AA Size 260, 430 of oMainWnd TRANSPARENT
@ 30, nY TITLE oBar_AA Size 370, 430 of oMainWnd TRANSPARENT
@ 30, nY TITLE oBar_AA Size 480, 430 of oMainWnd TRANSPARENT
n:= 0
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]
@ 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]
lFirst := .F.
Else
@ tX+n,tY TITLETEXT oVar_AA[t,01] OF oBar_AA TEXT aVar_AA[t,01]
@ 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]
Endif
n += 20
Next t
P6_AAAA->(DbCloseArea())
Return ( Nil )
********************************************
Now after ten minutes the figures need to be refreshed.....
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 to unreadable.
I re-initialize the array and update it, with fresh values.
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
@ 10, nY TITLETEXT OF oBar_AA TEXT " Daily Analysis"
// Making Box
@ 30, nY TITLE oBar_AA Size 150, 430 of oMainWnd TRANSPARENT
@ 30, nY TITLE oBar_AA Size 260, 430 of oMainWnd TRANSPARENT
@ 30, nY TITLE oBar_AA Size 370, 430 of oMainWnd TRANSPARENT
@ 30, nY TITLE oBar_AA Size 480, 430 of oMainWnd TRANSPARENT
n:= 0
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]
@ 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]
lFirst := .F.
Else
@ tX+n,tY TITLETEXT oVar_AA[t,01] OF oBar_AA TEXT aVar_AA[t,01]
@ 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]
Endif
n += 20
Next t
P6_AAAA->(DbCloseArea())
Return ( Nil )
********************************************
Now after ten minutes the figures need to be refreshed.....