In some circumstances, when the user selects a browse with a mouse click on a row ( say 4th row ) the xbrowse paints the first row information on the clicked row. Thereafter with arrow keys we can not go up but we can go down. 2nd row is painted on 5th row and so on. Please see the screen shot for example:

This is observed occasionally several times, but I could not reproduce it earlier. Now I have reproduced it in one case and give the code below. This code uses c:\fwh\samples\customer.dbf. The code creates necessary indexes and shows parent child scoped browses. The child table is related to the parent table with ordSetRelation. I also provided an option to choose either txbtowse or twbrowse. It can be seen the TWBrowse ( also TCBrowse) works perectly, and the problem is only with TXBrowse.
Code: Select all | Expand
#include 'fivewin.ch'#include 'xbrowse.ch'#define ORDRELREQUEST DBFCDXfunction main() OpenData() if alert( 'Choose Browse', { 'XBrowse', 'WBrowse' } ) == 1 testxbrw() else testwbrw() endif close datareturn nilfunction testxbrwlocal odlg, obrwSt, oBrw, ocol define dialog odlg size 800,340 pixel title 'TXBROWSE' @ 15,100 say 'XBROWSE CHILD TABLE' size 290,10 pixel of odlg center obrwSt := txbrowse():new(odlg) obrwSt:ntop := 30 obrwSt:nleft := 10 obrwSt:nright := 80 obrwSt:nbottom := 150 obrwSt:calias := 'state' ocol := obrwSt:addcol() ocol:cheader := 'State' ocol:bstrdata := {||state->State} oBrwSt:SetRDD() obrwSt:createfromcode() obrw := txbrowse():new(odlg) obrw:ntop := 30 obrw:nleft := 100 obrw:nright := 390 obrw:nbottom := 150 obrw:calias := 'cust' ocol := obrw:addcol() ocol:cheader := 'No' ocol:bstrdata := {||str( cust->(ordkeyno()),4)} ocol := obrw:addcol() ocol:cheader := 'First' ocol:bstrdata := {||cust->first} ocol := obrw:addcol() ocol:cheader := 'Last' ocol:bstrdata := {||cust->last} ocol := obrw:addcol() ocol:cheader := 'City' ocol:bstrdata := {||cust->City} obrw:setRDD() obrw:CreateFromCode() @ 160,100 SAY eval( obrw:bKeyNo ) picture '9999' size 40,10 pixel of odlg right update @ 160,160 SAY eval( obrw:bKeyCount ) picture '9999' size 40,10 pixel of odlg right update oBrwSt:bChange := {||RowChange(oBrwSt, oBrw)} oBrw:bChange := {||oDlg:update() } activate dialog odlg centered ; on init oBrwSt:SetFocus()return nilfunction testwbrwlocal odlg, obrwSt, oBrw, ocol define dialog odlg size 800,340 pixel title 'TWBROWSE' @ 15,100 say 'XBROWSE CHILD TABLE' size 290,10 pixel of odlg center @ 30,10 LISTBOX oBrwSt ; FIELDS state->state ; HEADERS 'State' ; SIZE 50,120 PIXEL OF oDlg ; ALIAS 'STATE' @ 30,100 LISTBOX oBrw ; FIELDS str(cust->(Ordkeyno()),4), cust->first, cust->last, cust->city ; HEADERS 'No', 'First', 'Last', 'City' ; SIZE 290,120 PIXEL OF odlg ; ALIAS 'CUST' obrw:bLogicLen := {||cust->(ordkeycount())}// @ 160,100 SAY eval( obrw:bKeyNo ) picture '9999' size 40,10 pixel of odlg right update @ 160,160 SAY eval( obrw:blogiclen ) picture '9999' size 40,10 pixel of odlg right update oBrwSt:bChange := {||RowChange(oBrwSt, oBrw)} oBrw:bChange := {||oDlg:update() } activate dialog odlg centered ; on init oBrwSt:SetFocus()return nilstatic function RowChange( oBrwSt, oBrw )#ifndef ORDREL cust->(OrdScope(0,state->state)) cust->(ordscope(1,state->state))#endif cust->(dbgotop()) oBrw:gotop() oBrw:Refresh(.t.) oBrw:oWnd:update()return nilstatic function OpenDatafield state, city, firstlocal cfile := '\fwh\samples\customer' ferase( cfile + '.cdx' ) use (cfile) exclusive via 'DBFCDX' index on state tag state unique index on state + city + first tag city use use (cfile) new alias state shared via 'DBFCDX' set order to tag state go top use (cfile) new alias cust shared via 'DBFCDX' set order to tag city go top#ifdef ORDREL// state->( ordsetrelation( 'cust', {||state}, 'state' ) )// state->( dbgotop() )// scoped relation can be set either way state->( dbsetrelation( 'cust', { || State }, 'State', .t. ) ) state->( dbgotop() )#else cust->( ordscope( 0, state->state ) ) cust->( ordscope( 1, state->state ) ) cust->( dbgotop() )#endifreturn nil
This program can be compiled and run straight away. No setup is required as long as the customer.dbf exists in \fwh\samples folder.
On the left parent browse of States is presented and on the right child browse of customers in that State is presented. The problem comes when a customer (other than the first line) is selected with a mouse click in the child browse. WBrowse works perfectly but not XBrowse.
Note: XBrowse works well when scope is set on child table on bhchange of the parent browse, but fails with scoped relation. The problem is NOT with scoped relation, because WBrowse works well with scoped relations also. Same is the problem with DBFCDX and also ADS. Therefore the problem is with XBrowse only.