TITLETEXT Refresh() Arrays...(SOLVED)

TITLETEXT Refresh() Arrays...(SOLVED)

Postby RiazKhan » 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.....

Image
Last edited by RiazKhan on Tue Jun 09, 2020 8:25 pm, edited 1 time in total.
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: NO RESPONSE = TITLETEXT Refresh() Arrays...???

Postby nageswaragunupudi » Sun Jun 07, 2020 10:22 am

From your code, it appears that you are creating the TITLE and TITLETEXT controls every 10 minutes. This results in creating the controls again and again over the existing controls resulting in smudging.

If my understanding is correct, we advise you to create the controls only the first time and when refreshing data subsequently, you only change the data displayed by oControl:SetText( cNewText ).

The code to refresh the data can be something like this:
Code: Select all  Expand view

for i := 1 to Len( oVar_AA )
   for j := 1 to 4
      oVar_AA:SetText( aVar_AA[ i, j ] )
   next
next
 


Next TITLETEXT does not support Right Alignment.

If I were to program this interface, I would have used XBrowse.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: NO RESPONSE = TITLETEXT Refresh() Arrays...???

Postby RiazKhan » Sun Jun 07, 2020 7:39 pm

Dear Mr. Rao

Thank You very much for your response and suggestion.
This interface is only a separate application for company directors and some finance department members.
The reason for using TITLETEXT format, was because to make the screen presentable and attractive. As it is being displayed for some company directors. I had to look into font size and color for easiness on eyes.

I will take your suggestion and try to convert to use XBROWSE. With your guidance and help as I am not very familiar with XBrowse.
I will post my screenshot with XBROWSE here for your expert views.

Thanks in advance.
Regards
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: jair and 40 guests