oBrw:Refresh(.T.) don't refresh new record

oBrw:Refresh(.T.) don't refresh new record

Postby dutch » Fri Apr 11, 2008 9:18 am

Dear All,

Code: Select all  Expand view
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
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: oBrw:Refresh(.T.) don't refresh new record

Postby Richard Chidiak » Fri Apr 11, 2008 9:28 am

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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: oBrw:Refresh(.T.) don't refresh new record

Postby Richard Chidiak » Fri Apr 11, 2008 7:41 pm

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

Image
Image

Code: Select all  Expand view
#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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby dutch » Fri Apr 11, 2008 11:40 pm

Thanks Richard,

I'll try your recommend.

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby nageswaragunupudi » Sat Apr 12, 2008 6:12 am

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?
Regards

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

Postby Richard Chidiak » Sat Apr 12, 2008 6:39 am

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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby nageswaragunupudi » Sat Apr 12, 2008 6:48 am

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.
Regards

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

Postby Richard Chidiak » Sat Apr 12, 2008 7:02 am

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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby nageswaragunupudi » Sat Apr 12, 2008 7:40 am

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
Regards

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

Postby nageswaragunupudi » Sat Apr 12, 2008 7:46 am

You are right.

With 8.03 I confirm your problem.
With 8.04 this is solved.
Regards

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

Postby nageswaragunupudi » Sat Apr 12, 2008 7:54 am

Incidentally I would also like to share with you how the new commands have simplified the coding.

Your earlier code
Code: Select all  Expand view
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  Expand view
@ 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
Regards

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

Postby Richard Chidiak » Sat Apr 12, 2008 8:01 am

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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby nageswaragunupudi » Sat Apr 12, 2008 8:05 am

Mr Richard

With 8.04
Before edit
Image
After Edit
Image

I hope this is what we want. Am I right ?
Regards

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

Postby Richard Chidiak » Sat Apr 12, 2008 8:26 am

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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby nageswaragunupudi » Sat Apr 12, 2008 8:51 am

Mr Richard

Please see this
Image

Is this okay ?
Regards

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests