Bug in wbrowse

Bug in wbrowse

Postby concentra » 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: Select all  Expand view

#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
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Bug in wbrowse

Postby MarcoBoschi » Fri Jan 27, 2012 11:12 am

This is a patch
obrw:gotop()
before
IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )
User avatar
MarcoBoschi
 
Posts: 1018
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Bug in wbrowse

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

Re: Bug in wbrowse

Postby concentra » Tue Jan 31, 2012 9: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
User avatar
concentra
 
Posts: 110
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Bug in wbrowse

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Willi Quintana and 14 guests