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
#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. )