Page 1 of 2
oBrw:Refresh(.T.) don't refresh new record
Posted: Fri Apr 11, 2008 9:18 am
by dutch
Dear All,
Code: Select all
DEFINE TIMER oTimer OF oWnd INTERVAL 5000 ACTION (oBrw:Refresh(.T.))
I use oBrw:Refresh( .T. ) for refresh new record but when I enter the new record, it doesn't show on the Browse.
oBrw:Refresh( .T. ) = :Upstable() ? When the new record append, should it show on the Browse?
Regards,
Dutch
Re: oBrw:Refresh(.T.) don't refresh new record
Posted: Fri Apr 11, 2008 9:28 am
by Richard Chidiak
Dutch
Try obrw:gobottom() before obrw:refresh(.t.) and make sure you have
oBrw:bBookMark := {| n | iif( n == nil,(MYALIAS)->(RecNo()), (MYALIAS)->(dbgoto(n)) ) } // Required!
anyway when using rdd, xbrowse refresh is still buggy and not performing as expected, i will post a sample today that shows the problem.
Richard
Re: oBrw:Refresh(.T.) don't refresh new record
Posted: Fri Apr 11, 2008 7:41 pm
by Richard Chidiak
Antonio,
Can you please take a look at the sample below
i join 2 images that show the problem, still refresh has bad painting
Refresh(.t.) will force the record to be first on the list qnd redraw the whole page which is not always what we want to do.
Thanks for help
Richard
fwh 8.03
Code: Select all
#include "FiveWin.ch"
#include "xbrowse.ch"
function MAIN()
LOCAL AADBF := {}, ;
I := 0, ;
OBRW
REQUEST DBFCDX
Rddsetdefault( "DBFCDX" )
ERASE ("TEST.DBF")
ERASE ("TEST.CDX")
aADBF := {}
AADD(aADBF, {"NAME", "C", 40, 0 })
AADD(aADBF, {"NUMID", "N", 06, 0 })
DBCREATE("TEST", aADBF)
USE TEST NEW
INDEX ON NUMID TAG "NUMID"
INDEX ON NAME TAG "NAME"
TEST->(ORDSETFOCUS("NAME"))
FOR I = 1 TO 100
APPEND BLANK
REPLACE TEST->NUMID WITH I
REPLACE TEST->NAME WITH "NAME" + STR(I,3)
NEXT
TEST->(DBGOTOP())
DEFINE WINDOW oWnd FROM 0,0 TO 23,78
oBrw := TXBrowse():New( oWnd )
oBrw:bClrStd := {|| { CLR_BLUE, CLR_WHITE } }
oCol:=oBrw:AddCol()
oCol:bStrData:= {|| TEST->NAME }
oCol:cHeader := "Name"
ocol:nWidth := 200
oCol:bEditvalue := { || TEST->NAME }
oCol:nEditType := EDIT_GET
oCol:bonPostEdit := { | oCol, uValue, nLastKey | If( nLastKey == 13, (TEST->NAME := uValue , obrw:refresh()), nil ) }
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:SetRDD()
oBrw:bBookMark := {| n | iif( n == nil,TEST->(RecNo()), TEST->(dbgoto(n)) ) } // Required!
oBrw:CreateFromCode()
ownd:oClient := oBrw
ACTIVATE WINDOW OWND
TEST->(DBCLOSEAREA())
ERASE ("TEST.DBF")
ERASE ("TEST.CDX")
return nil
Posted: Fri Apr 11, 2008 11:40 pm
by dutch
Thanks Richard,
I'll try your recommend.
Regards,
Dutch
Posted: Sat Apr 12, 2008 6:12 am
by nageswaragunupudi
Mr Richard
I am testing your program and I am not facing any problem here. The edited value is correctly shown at the right place and browse painted correctly. I have already downloaded 8.04 but I think 8.04 and 8.03 may not be much different.
Refresh( .t. )'s intended behavior is to GoTop. Normally we should use Refresh only. We should use Refresh(.t.) when we want gotop also.
>
oBrw:bBookMark := {| n | iif( n == nil,TEST->(RecNo()), TEST->(dbgoto(n)) ) } // Required!
>
Actually this is not necessary. SetRDD assigns exactly the same code block to :bBookMark. Assigning it once again in our code is only a duplication.
Am I missing anything? Can you tell me how to reproduce your problem?
Posted: Sat Apr 12, 2008 6:39 am
by Richard Chidiak
Mr NageswaraRao
I am just editing at line name 8 and replacing the 8 with 3a value then enter, i can reproduce the problem every time. I am using standard fwh 8.03 and standard xbrowse from fwh not modified. Maybe your copy of xbrowse is different ?
Would you mind building the sample with standard xbrowse from fwh and let me know if you get the same result ? I have not yet installed fwh 8.04 (planned this week end) but as you said i guess there should not be a difference in xbrowse.
Thank you for your help
Richard
Posted: Sat Apr 12, 2008 6:48 am
by nageswaragunupudi
Mr Richard
>
I am just editing at line name 8 and replacing the 8 with 3a value then enter,
>
Yes this is what I have done. I always use FWH original code only for this forum postings. I have used 8.04 and now tested by linking with 8.03 xbrowse prg. both give me the same results.
You said you can not reproduce the problem always. So I shall also keep a watch and if this happens occassionally to me. It appears lot of improvement has been made recently in this area recently.
Posted: Sat Apr 12, 2008 7:02 am
by Richard Chidiak
Mr NageswaraRao
This is very strange. I reproduce the problem everytime.
In fact the problem appears everytime you try to set a lower key than your current one, i mean a key that should be displayed before.
What happens is the new line is diplayed at the proper place and at the previous line also which is bad.
in my sequence i had 1 , 2 ,34,5,6,7,8,9...
i replace 8 with 3a i should have 1,2,3,3a,4,5,6,7,9....
the 7 is replaced with 3a also this is causing the bad refresh
I hope i made it clear, did you try to set a lower key ? in case of a upper key that will force the page to change, refresh is OK
I agree that xbrowse has made a lot of improvements.
Thanks for the help,
Richard
Posted: Sat Apr 12, 2008 7:40 am
by nageswaragunupudi
Mr Richard
>
n fact the problem appears everytime you try to set a lower key than your current one, i mean a key that should be displayed before.
>
Yes. I have done that only. I have no issues
Anyway now i shall complie with 8.03 xbrowse code "once again". I shall get back in a few minutes
Posted: Sat Apr 12, 2008 7:46 am
by nageswaragunupudi
You are right.
With 8.03 I confirm your problem.
With 8.04 this is solved.
Posted: Sat Apr 12, 2008 7:54 am
by nageswaragunupudi
Incidentally I would also like to share with you how the new commands have simplified the coding.
Your earlier code
Code: Select all
oBrw := TXBrowse():New( oWnd )
oBrw:bClrStd := {|| { CLR_BLUE, CLR_WHITE } }
oCol:=oBrw:AddCol()
oCol:bStrData:= {|| TEST->NAME }
oCol:cHeader := "Name"
ocol:nWidth := 200
oCol:bEditvalue := { || TEST->NAME }
oCol:nEditType := EDIT_GET
oCol:cSortOrder := "NAME"
oCol:bonPostEdit := { | oCol, uValue, nLastKey | If( nLastKey == 13, (TEST->NAME := uValue , obrw:refresh()), nil ) }
(TEST->NAME := uValue ), nil ) }
oBrw:SetRDD()
//oBrw:bBookMark := {| n | iif( n == nil,TEST->(RecNo()), TEST->(dbgoto(n)) ) } // Required! // NOT REQUIRED
This can now be written as
Code: Select all
@ 0,0 XBROWSE oBrw COLUMNS "Name" ALIAS "TEST" COLOR CLR_BLUE,CLR_WHITE
oCol := oBrw:aCols[ 1 ]
oCol:nEditType := EDIT_GET
oCol:bonPostEdit := { | oCol, uValue, nLastKey | If( nLastKey == 13, ;
(TEST->NAME := uValue , obrw:refresh()), nil ) }
We get the same functionality
When you download 8.04 the present problem may not be there
Posted: Sat Apr 12, 2008 8:01 am
by Richard Chidiak
Thank you for taking time to test the problem
I am happy to know that this issue is solved in fwh 8.04, i will install this version today and report back
The new syntax is quite nice, i have used it also (not all of it since there are new commands in there)
Thanks again and best regards
Richard
Posted: Sat Apr 12, 2008 8:05 am
by nageswaragunupudi
Mr Richard
With 8.04
Before edit
After Edit
I hope this is what we want. Am I right ?
Posted: Sat Apr 12, 2008 8:26 am
by Richard Chidiak
Mr NageswaraRao
You are right, this is the correct behaviour
Though i will test and try to place at another line than first to see that there are no painting problems something in between 2 or 3 for instance
Richard
Posted: Sat Apr 12, 2008 8:51 am
by nageswaragunupudi
Mr Richard
Please see this
Is this okay ?