Bug in wbrowse

Post Reply
User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Bug in wbrowse

Post by concentra »

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: Select all

#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. )
 
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Bug in wbrowse

Post by MarcoBoschi »

This is a patch
obrw:gotop()
before
IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )
Marco Boschi
info@marcoboschi.it
User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Bug in wbrowse

Post by concentra »

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...
User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Bug in wbrowse

Post by concentra »

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
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Bug in wbrowse

Post by MarcoBoschi »

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
Post Reply