FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in wbrowse
Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Bug in wbrowse
Posted: Fri Jan 27, 2012 10:41 AM
Hi.

Seems I found a bug in wbrowse when moving the file pointer.
If I change the current record of the browsed file and call a refresh ,the wbrowse goes to new record position as expected.
Until a mouse click is used to change the current wbrowse position, in some circumstances.
In the sample I provide, the file is indexed by a char field that goes from "10" to "25".
The get object validation points the file in the typed record and calls wbrowse's refresh and everything goes Ok.
But if, for example, I type "10", the browse goes to "10" as expected, and after that i click in "16" and after that type anything between "10" and "16" the wbrowse always goes to "16".
If I type from "17" to "25" the browse goes Ok !
The mouse click is doing something I was unable to find...
I had some big troubles because of this behavior, causing writing wrong data in a production environmrent. :cry:

Antonio, could you inspect this ?

A small sample of the problem:
Harbour 3.1.0dev (Rev. 17102)
FiveWin Harbour October 2011
Code (fw): Select all Collapse
#INCLUDE "FIVEWIN.CH"

FUNCTION MAIN()

   GenerateTestFile()

   cCodigo := "  "

   DEFINE WINDOW oDlg FROM 1,1 TO 20,60

   @ 1,5 GET oGetCodigo VAR cCodigo OF oDlg VALID( V_Codigo() ) SIZE 90, 22

   oBrw := TWBrowse():New( 5,5,400,150,,,,oDlg,,,,,,,,,,,,, "TESTBRW" )
   oBrw:SetCols( {{ || TESTBRW->CODIGO }}, {"Produto"}, {260} )

   ACTIVATE DIALOG oDlg

RETURN

/************************************************/
STATIC FUNCTION V_Codigo()
/************************************************/

   IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )
      oBrw:Refresh()
   ENDIF

   oGetCodigo:cText( "  " )

RETURN( .F. )

/************************************************/
STATIC FUNCTION GenerateTestFile()
/************************************************/

   aSTRU := { { "CODIGO", "C", 2, 0 } }
   DBCREATE( "TESTBRW.DBF", aSTRU )

   USE TESTBRW EXCLUSIVE
   INDEX ON FIELD->CODIGO TAG "COD"

   FOR I := 10 TO 25
      DBAPPEND()
      FIELD->CODIGO := STR(I,2)
   NEXT

   TESTBRW->( DBGOTOP() )

RETURN( .F. )
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Bug in wbrowse
Posted: Fri Jan 27, 2012 11:12 AM

This is a patch
obrw:gotop()
before
IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )

Marco Boschi
info@marcoboschi.it
Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Re: Bug in wbrowse
Posted: Fri Jan 27, 2012 12:01 PM
MarcoBoschi wrote:
obrw:gotop()
before
IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )

In this way mouse clicking does not function.
And this not so good...
Posts: 124
Joined: Mon Nov 14, 2005 10:15 AM
Re: Bug in wbrowse
Posted: Tue Jan 31, 2012 09:14 AM

Hi.
Antonio, could you inspected this ?
I am insisting in it because the browse also moves the current file record by itself, causing unpredictable behavior.

Regards,

Maurício Ventura Faria

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Bug in wbrowse
Posted: Tue Jan 31, 2012 10:55 AM
Try this:

/************************************************/
STATIC FUNCTION V_Codigo()
/************************************************/

IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )
oBrw:upstable()
oBrw:Refresh()
ENDIF

oGetCodigo:cText( " " )

RETURN( .F. )
Marco Boschi
info@marcoboschi.it

Continue the discussion